class Keys():
def __init__(self):
self.key_list = {1:"one", 2:"two", 3:"three"}
def get_name(self, key):
self.ddd = key
key1 = Keys
key1.get_name(1)
Why, after starting this code, do I get this error:
Traceback (most recent call last):
File "class.py", line 8, in <module>
key1.get_name(1)
TypeError: get_name() missing 1 required positional argument: 'key'
I am using Python 3.
You probably meant:
Note the use of parenthesis:
key1 = Keys()