Hello, I want to create a list of lists of lists (listB) from a list of lists (listA). Below there's a snippet of my code:
list1 = [[] for i in range(9)] # some code here... listA = [[] for i in range(3)] count = 0 for i in range(3): for j in range(3): listB[i].append(listA[count]) count+=1 My question is: is there any alternative way I can initialize listB without resorting to using 2 loops? I'm learning Python coming from a C++ background. So far, I've found that Python is an amazingly concise and expressive language. I just want to make sure I'm not being badly influenced by my old C++ habits. Cheers, Kaixi
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor