generating unique variable name via loops

Peter Otten __peter__ at web.de
Tue Nov 4 08:37:31 EST 2014


Veek M wrote:

> Fatih Güven wrote:
> 
>> 4 Kas?m 2014 Sal? 13:29:34 UTC+2 tarihinde Fatih Güven yazd?:
>>> I want to generate a unique variable name for list using python.
>>> 
>>> list1=...
>>> list2=...
> 
> for x in range(1,10):
>     exec("list%d = []" % x)

Why would you do this? 





More information about the Python-list mailing list