Acquaintance loop

while loop

while 条件:
 循环体   

break: Terminator Cycle

continue: out of this cycle, continue to the next cycle (you can continue understood as the last line of the loop body)

for loop

When the cycle has been assigned

Alone can not circulate is integer (int) and boolean value (bool)

***for i in 可迭代对象***

for i in msg:
 print(i)
# for 关键字
# i 变量名(可以任意修改)
# in 关键字
# msg 可迭代对象

Guess you like

Origin www.cnblogs.com/lingshuai/p/11571675.html