* On 10/04/2013 10:40, martaamu...@gmail.com wrote: > Hi! > > I would like to create a list containing lists. I need each list to > have a differente name and i would like to use a loop to name the > list. > [...] > global_list=[] > for i in range (20): > ("list_"+i)=[] #These would be the name of the list... > global_list.append("list_"+i)
You can use a dictionary instead of a list of lists: global_list = {'_'.join(['list', str(i)]):[] for i in range(20)} global_list_1 = global_list['list_0'] -- http://mail.python.org/mailman/listinfo/python-list