![](/img/trans.png)
[英]How to use the index in an enumerate for loop with if statement (python)
[英]How to use enumerate function in python to get the count of the iteration in a for loop?
for idx,server in enumerate(servers ):
print idx
这是抛出错误。 如何打印迭代次数?
for idx, server in enumerate(servers):
print(idx)
缩进很重要,因此将代码块放在适当的深度。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.