[英]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
This is throwing an error.这是抛出错误。 How to print the count of iterations?
如何打印迭代次数?
for idx, server in enumerate(servers):
print(idx)
Indentations are important, so put the codeblock at the appropriate depth.缩进很重要,因此将代码块放在适当的深度。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.