【发布时间】:2018-10-11 20:18:33
【问题描述】:
我想获取我在 for 循环中循环的次数
for x in dictionary:
print(timeslooped) # If the looped has looped 4 times then this should print 4
我该怎么做?
这是一个非常简单的问题,但我最近学习了 Python,但我不确定。谢谢!
【问题讨论】:
-
做一个枚举?
-
调用
enumerate或在之后(如果基于0)或之前(如果基于1)增加一个整数变量以获取实际索引。