【发布时间】:2011-10-14 08:19:36
【问题描述】:
好的动态我的意思是在运行时未知。
这是一个字典:
aDict[1]=[1,2,3]
aDict[2]=[7,8,9,10]
aDict[n]=[x,y]
我不知道 n 会有多少,但我想循环如下:
for l1 in aDict[1]:
for l2 in aDict[2]:
for ln in aDict[n]:
# do stuff with l1, l2, ln combination.
关于如何做到这一点的任何建议?我对python比较陌生,所以请温柔一点(虽然我用php编程)。顺便说一句,我正在使用 python 3.1
【问题讨论】: