1 while True 死循環示例: 2 3 count = 0 #給count設置變量為0 4 while True: 5 count += 1 #每循環一次,count+1 ; count += 1 等同於count = count+1 意思是一樣的 6 if count >=50 and count <=60: #對比count的值,設置循環中50-60之間的字符不打印 7 continue #如果條件匹配,到這里就不往下執行了,continue回到起點 8 print ("張江華",count) #打印,count 輸出打印的次數 9 if count ==100: #循環如果到100次,就跳出循環 10 print ("已經循環夠了100次,退出循環!") 11 break
