I have the following code:
class Test:
pass
test = Test()
for x in ["a", "b", "c"]:
test.x = x
print(test.__dict__)
{'x': 'c'}
This is not what I want. What I want is to set the name of the attribute corresponding to the value of the iteration:
Desired:
print(test.__dict__)
{'a': 'a', 'b': 'b', 'c': 'c'}
How can I do that?