如何在if子句中增加范围python中的索引i?

时间:2018-11-27 16:35:15

标签: python

a = "a4b4t8a3a3w2q5a8o9i8"
for i in range(0, len(a)):
  if a[i].isdigit() is False:
    print("detected letter")
    i +=5 #this does not increase the i by 5 each tiem I find a letter

这无助于索引“ i”向前跳5。为什么?

1 个答案:

答案 0 :(得分:0)

尝试一下

a[i + 5]

代替

i + 5