I want to let the name of an attribute be the string value of a variable. Here
is some code:
class Object(object): pass
A = Object()
s = 'attr'
A. = 1
The last line denotes the variable value by (not a python form). What I
want is to have A.attr = 1, but 'attr' determined by the value of s.
I am looping as for L in file.readlines(), where file is csv.
L is a list of 3 items, eg, [{'a':1, 'b':2}, [1,2,3], 10] Note that the first
item is a dir and 2nd is a list, so parsing with split doesn't work. Is there
a way to convert L, which is a string, to the list of 3 items I want?
--
ht
On Saturday, October 5, 2013 7:24:39 PM UTC-6, Tim Chase wrote:
> On 2013-10-05 18:08, Harvey Greenberg wrote:
>
> > I am looping as for L in file.readlines(), where file is csv.
>
> >
>
> > L is a list of 3 items, eg, [{'a':1, 'b':2}, [1,2,3]
On Sunday, October 6, 2013 10:41:33 AM UTC-6, Harvey Greenberg wrote:
> On Saturday, October 5, 2013 7:24:39 PM UTC-6, Tim Chase wrote:
>
> > On 2013-10-05 18:08, Harvey Greenberg wrote:
>
> >
>
> > > I am looping as for L in fi
On Saturday, October 5, 2013 7:08:08 PM UTC-6, Harvey Greenberg wrote:
> I am looping as for L in file.readlines(), where file is csv.
>
>
>
> L is a list of 3 items, eg, [{'a':1, 'b':2}, [1,2,3], 10] Note that the first
> item is a dir and 2nd is a li