如何用计数器在python中循环

如题所述

通常有这样的方法:
for index, item in enumerate(n):
if index % nth == 0: # If the output is not like you want, try doing (index + 1), or enumerate(n, start=1).
print(item)
温馨提示:答案为网友推荐,仅供参考
相似回答