0

How can access to class's attributes with python like:

for key in data:
        m.key = data[key]

If i do this, 'm' will create an new attribute "key" but i want write attribute which is in key.

For exemple:

m =Class()
data ={"user_username" : "toto", "user_password" : "titi", "user_other" : "" }
for key in data:
     m.key = data[key]

'm' has attributes "user_username","user_password",etc...

if i do this, new attribute "key" will be created with value "toto" but i want change m."user_username" and not add m."key"...

P.Henry F
  • 31
  • 1
  • 6

0 Answers0