while循环:

while true:
 pass

for循环:

for n in range(1,100):
 print()
 elif(等于else if)
 print()

多重循环

python 多重json python 多重循环写一行_python


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