while循环:
while true:
pass
for循环:
for n in range(1,100):
print()
elif(等于else if)
print()
多重循环
for i,j in itertools import.product(range(1,10),range(1,10)):
print(i,j)
continue语句
跳出当前循环,执行下一循环
break语句
跳出整个循环
.format用法
‘hello {}’.format(‘world’)
‘hello {0} {1}’.format(‘world !’)
#在{}可以指定位置
end=’ '
在结尾加一个空字符串,print显示不换行
.center(10)
让print输出的字符占10个空格
python语法——循环
最新推荐文章于 2024-07-20 17:12:48 发布