遍历循环保留字

s="python"
while s!="":
for c in s:
if c=="t":
break
print(c,end='')
s=s[:-1]
输出结果:pypypypypyp

s="python"
while s!="":
for c in s:
if c=="t":
continue
print(c,end='')
s=s[:-1]
输出结果:pyhonpyhopyhpypyp

猜你喜欢

转载自www.cnblogs.com/pengwa1226/p/10459281.html