V
Vikas Mahajan
Hello to all
I am new to python. I am facing problem to use variables as object
attributes. I have to use loop and dynamically add attributes to a
object and for this purpose I have to use variables with object names.
For example-:
Let us say object car has an attribute engine, then
varname = "engine"
car.varname = "dummy value"
is giving me Error: object car does not have attribute varname.
Please tell me how can I use variables as objects attributes.
Thanks.
I am new to python. I am facing problem to use variables as object
attributes. I have to use loop and dynamically add attributes to a
object and for this purpose I have to use variables with object names.
For example-:
Let us say object car has an attribute engine, then
varname = "engine"
car.varname = "dummy value"
is giving me Error: object car does not have attribute varname.
Please tell me how can I use variables as objects attributes.
Thanks.