I have created the following class. Package, website and comments are all strings and distroDict is a (string, list) dictionary.
class TableEntry(object):
def __init__(self, package, website, distroDict, comments):
self.package = package
self.website = website
self.distroDict = distroDict
self.comments = comments
I want to use defaultdict(TableEntry) to make a (string, TableEntry) custom dictionary.
tableDict = defaultdict(TableEntry)
entry = TableEntry(package, website, distroDict, comments)
tableDict[package].append(entry)
I want the package to be the key and the entry object to be the value. I can use values within the entry object but if I try to append it to tableDict I receive the following error.
Traceback (most recent call last):
File "wiki.py", line 151, in <module>
printMetaData(lines, f)
File "wiki.py", line 73, in printMetaData
tableDict[package].append(entry)
TypeError: __init__() takes exactly 5 arguments (1 given)
I have also tried the following:
tableDict[package].append(TableEntry(package, website, distroDict, comments))
And receive the same error essentially:
Traceback (most recent call last):
File "wiki.py", line 150, in <module>
printMetaData(lines, f)
File "wiki.py", line 73, in printMetaData
tableDict[package].append(TableEntry(package, website, distroDict, comments))
TypeError: __init__() takes exactly 5 arguments (1 given)