-1

How can i make a list's name change for each round in a for loop as below?

list_of_names=["A","B"]

for item in list_of_names:
    x_i=[1,2,3]
    print "done"

The for loop will have 2 loops so I would like 'i' in x_i to be x_A and x_B for each loop respectively.

alexvassel
  • 10,600
  • 2
  • 29
  • 31
jxn
  • 7,685
  • 28
  • 90
  • 172

1 Answers1

0
d={}    
for item in list_of_names:
    d['x_'+i]=[1,2,3]
    print "done"

you can use a dictionary to initialise the value

sundar nataraj
  • 8,524
  • 2
  • 34
  • 46