I would like to transform "a" + str (1) into a1 without being a strig, so I can associate a value "a" with str (1) = 2 how do I?

1
"a"+str(1)=2
File "<ipython-input-44-929460161ba7>", line 1
    "a"+str(1)=2
                ^
  

SyntaxError: can not assign to operator

I want to create a series of variables a1 a2 a3 an and then associate with a value each

    
asked by anonymous 15.12.2016 / 17:47

1 answer

2

Make a list instead of trying to create variables programmatically (which is possible but not a good idea):

a =[]
a[1] = 2

I believe this is what you want to do.

    
15.12.2016 / 18:27