我在几个嵌套的循环中循环。如果第一个循环的项发生变化,我想打印它。我怎么能做到呢?在
for slope in slopeList:
for yarddist in yardDistList:
for chiptreesperacre in chipAcreList:
for chipvolpertree in chipVolList:
for smalllognumber in smallAcreList:
for smalltreevolpertree in smallVolList:
for largelogperacre in largeAcreList:
for largetreevolpertree in largeVolList:
data = [slope, yarddist, chiptreesperacre, chipvolpertree, smalllognumber, smalltreevolpertree, largelogperacre, largetreevolpertree]
if slope changes:
print data
您可以将先前的斜率添加到set中,并在内部循环中观察添加后的长度:
对每个内循环重复此模式。在
存储您以前看到的值,并将其进行比较:
相关问题 更多 >
编程相关推荐