可能重复:
How can I put an element of a string in a list with a certain behaviour如何获得的元组的数量从列表的列表在python
假设我有两个列表:
list1 = [[(1, 1), (1, 2), (1, 3), (1, 4)]]
list2 = ['A']
现在我需要类似
dic1 = {'A': len(list1)}
现在len(list1)
应该是4
,因为我需要数组的数目在这种情况下是4
看起来像list1包含1个列表,其长度是4.列表1的长度应为1. – NominSim 2012-07-31 15:37:49
您是否可以从您以前的问题和答案中得到这个? http://stackoverflow.com/questions/11726305/how-can-i-put-an-element-of-a-string-in-a-list-with-a-certain-behaviour – 2012-07-31 15:50:08