you would need to define a class first with its attiributes and then you may want to initiate the variables by calling the class initilializer
On Mon, Aug 16, 2010 at 7:10 PM, Vikas Mahajan <vikas.mahaja...@gmail.com>wrote: > 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. > -- > http://mail.python.org/mailman/listinfo/python-list > -- Nitin Pawar
-- http://mail.python.org/mailman/listinfo/python-list