numbering variables

Patrick Useldinger pu.news.001 at gmail.com
Mon Mar 28 14:19:28 CEST 2005


remi wrote:
> Hello,
> 
> I have got a list like : mylist = ['item 1', 'item 2',....'item n'] and 
> I would like to store the string 'item1' in a variable called s_1, 
> 'item2' in s_2,...,'item i' in 's_i',... The lenght of mylist is finite ;-)
> Any ideas ?
> Thanks a lot.
> Rémi.

Use a dictionary: variable['s_1']= mylist.pop(), variable['s_2'] = 
mylist.pop() ...



More information about the Python-list mailing list