for i in range (0, 81):
output = send command
while True:
last_byte = last_byte - offset
if last_byte > offset:
output = send command
i+
else:
output = send command
i+
break
我想在每次执行发送命令时增加迭代器。现在它只在执行 for 循环时增加 1。请指教
for i in range(0,10):
print(i)
i +=2
print("increased i", i)
我运行这段代码,结果是从 0 到 9。我原以为它会将迭代器增加 2。
原文由 ilaunchpad 发布,翻译遵循 CC BY-SA 4.0 许可协议
将迭代器的副本保存为命名对象。如果你愿意,你可以跳过。