您没有按照自己的想法去做。
例如:
for i in range(10):
无论如何,它将始终设置
i为范围内的下一个元素
0-10。
如果要在python中执行等效 *** 作,则可以执行以下 *** 作:
i = 0while i < 10: print(i) if i == 2: i = 4 else: # these line are i += 1 # the correct way i += 1 # note that this is wrong if you want 1,2,4,5,6,7,8,9
如果您正试图将其转换为
C,那么你必须记住,
i++在
for循环会一直添加到
i。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)