python create object and add attributes to it
- by John
Hi,
I want to create a dynamic object (inside another object) in python and then add attributes to it.
I tried:
obj = someobject
obj.a = object()
setattr(obj.a, 'somefield', 'somevalue')
but this didn't work.
Any ideas?
Thanks