给定以下列表:
[[0.074, 0.073, 0.072, 0.03, 0.029, 0.024, 0.021, 0.02], [0.02, 0.02, 0.015], [0.026, 0.026, 0.02, 0.02, 0.02, 0.015], [0.021, 0.02] 17, 0.021, 0.0 , [0.077, 0.076, 0.074, 0.055, 0.045, 0.021], [0.053, 0.052, 0.051, 0.023, 0.022], [0.016, 0.016]]
我如何循环浏览列表并从每个子列表中提取 #1,从每个子列表中提取 #2,从每个子列表中提取 #3 并生成单独的列表。
例如,在这种情况下,#1 应包括 0.074、0.02、0.026、0.021、0.077、0.063 和 0.016。他们将在一个单独的独立列表中。
我使用了while循环,但它对我不起作用:
a=0
b=len(data['stock'])
while a<=b - 1:
print data['stock'][a][0]
a = a + 1
print "\n"
while a<=b - 1:
print data['stock'][a][1]
a = a + 1
print "\n"
while a<=b - 1:
print data['stock'][a][2]
a = a + 1
print "\n"
while a<=b - 1:
print data['stock'][a][3]
a = a + 1
print "\n"
while a<=b - 1:
print data['stock'][a][4]
a = a + 1
print "\n"
while a<=b - 1:
print data['stock'][a][5]
a = a + 1
print "\n"
while a<=b - 1:
print data['stock'][a][6]
a = a + 1
print "\n"
有多少我解决了这个问题并根据上述逻辑创建了列表?