python语法——循环

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个空格

猜你喜欢

转载自blog.csdn.net/qq_44542770/article/details/88388208
今日推荐