Created
December 9, 2011 00:38
-
-
Save davidthewatson/1449507 to your computer and use it in GitHub Desktop.
python: set attributes in class given key value pairs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class a(): | |
def set_attrs_in_class_given_key_value_pairs(**kwargs): | |
for k,v in kwargs.iteritems(): | |
setattr(self, k, v) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment