Python 列表中的每个条目都表示bij顺序

Python 列表中的每个条目都表示bij顺序,python,list,Python,List,我正在尝试按顺序在列表中添加我的所有条目我的脚本是: for item in klantgegevens: teller = (number, item) number = number + 1 print teller 三K党: (['Cautus B.V. Zei 9-11', 'Cautus B.V.', '1', '2', '', '', '', '', '', ' Zei 9-11', '1009023', '10', 'Geachte

我正在尝试按顺序在列表中添加我的所有条目我的脚本是:

   for item in klantgegevens:
       teller = (number, item)
       number = number + 1
       print teller
三K党:

(['Cautus B.V. Zei 9-11', 'Cautus B.V.', '1', '2', '', '', '', '', '', ' Zei 9-11', '1009023', '10', 'Geachte Daa', 'Mevrouw Daa', 'chaa.c2000@planet.nl']) 
(['Cautus B.V. 32', 'Cautus B.V.', '1', '2', '', '', '', '', '', 'Trias 92', '1109008', '10', 'Geachte mevrouw Daa', 'Mevrouw Daa', 'chaa.c2100@planet.nl'])
我希望我的输出是:

    (0, ['Cautus B.V. Zei 9-11', 'Cautus B.V.', '1', '2', '', '', '', '', '', ' Zei 9-11', '1009023', '10', 'Geachte Daa', 'Mevrouw Daa', 'chaa.c2000@planet.nl']) 
    (1, ['Cautus B.V. 32', 'Cautus B.V.', '1', '2', '', '', '', '', '', 'Trias 92', '1109008', '10', 'Geachte mevrouw Daa', 'Mevrouw Daa', 'chaa.c2100@planet.nl'])
     2 .....
     3 .....
     4 ....
在此处使用
enumerate()

In [229]: klantgegevens=[['Cautus B.V. Zei 9-11', 'Cautus B.V.', '1', '2', '', '', '', '', '', ' Zei 9-11', '1009023', '10', 'Geachte Daa', 'Mevrouw Daa', 'chaa.c2000@planet.nl'],
['Cautus B.V. 32', 'Cautus B.V.', '1', '2', '', '', '', '', '', 'Trias 92', '1109008', '10', 'Geachte mevrouw Daa', 'Mevrouw Daa', 'chaa.c2100@planet.nl']]

In [231]: for i,x in enumerate(klantgegevens):
   .....:     print (i,x)
   .....:     
   .....:     
(0, ['Cautus B.V. Zei 9-11', 'Cautus B.V.', '1', '2', '', '', '', '', '', ' Zei 9-11', '1009023', '10', 'Geachte Daa', 'Mevrouw Daa', 'chaa.c2000@planet.nl'])
(1, ['Cautus B.V. 32', 'Cautus B.V.', '1', '2', '', '', '', '', '', 'Trias 92', '1109008', '10', 'Geachte mevrouw Daa', 'Mevrouw Daa', 'chaa.c2100@planet.nl'])

您正在寻找内置函数。似乎您有一个列表,其中有一个元素是列表列表列表,因此您必须对这一个元素(列表列表)调用
enumerate


@user1752643
klantgegevens
看起来怎么样?但我需要对每个条目进行编号,而不是对每个项目进行编号。我的BadPleaseee post值
klantgevens
和问题正文中的预期输出,这里不太清楚。我在qeustion@user1752643解决方案编辑,并将
klantgevens
用作列表列表。您的
klantgevens
不是正确的数据类型。它是两个并排的元组。那么
klantgegevens
是一个列表列表吗?因为您将项目作为单独的元组发布。我只使用了2个条目作为示例,这是如何打印出来的,但它是一个列表。如果您使用Klantgeevens中元素的代码
:print elem
打印Klantgeevens,则会得到您在问题中显示为
Klantgeevens
的结果。没有另一个Klantgeggevens包含所有元素,但我在1后面加上了1,所以它只有1个元素。这样我就可以增加所有条目的数量,否则它会在所有元素上循环
for teller in enumerate(klantgegevens[0]):
    print teller