KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a class defined as follows class M(object): def __init__(self, **kwargs): ...do_something and I have the result of argparse.parse_args() , for example: > args = parse_args() > print args Namespace(value=5, message='test', message_type='email', extra="blah", param="whatever") I want to pass on the values of this namespace (except message_type ) to create an instance of the class M . I have tried M(args) but got an error TypeError: __init__() takes exactly 1 argument (2 given) which I do not understand. How can I remove the value message_type from the list in args pass on the values as if I would type M(value=5, message='test', extra="blah", param="whatever") directly.
Tags (comma-separated)
Save Edits
Cancel