我有點困惑,在這裏,執行「continue」後,它會自動跳出當前迭代,並且不會更新的索引,對吧?'繼續'如何在這個Python代碼中工作?
def method(l):
index = 0
for element in l:
#if element is number - skip it
if not element in ['(', '{', '[', ']', '}', ')']:
continue // THIS IS MY QUESTION
index = index+1
print("index currently is " + str(index))
print("--------------------\nindex is : " + str(index))
t = ['4', '7', '{', '}', '(']
method(t)
是的,你是正確的 – TerryA
這絕對是一個簡單的控制檯嘗試它的例子將有助於噸:)。 – Chinny84
omg,自從大學以來,我有這種知識差距....謝謝你們! – ERJAN