5.replace的用法,while循环,continue

1.relace
s=’dadk12′

print(s.replace(‘生活’,’dd’))==打印返回dadk12,即使没有也不会报错。
2.while continue
while循环输出 1 2 3 4 5 6 8 9 10

(1)
count=1
while count<11:
if count==7:
continue#这里的continue打印到6就会停止
print(count)
count +=1
(2).
count=1
while count<11:
if count==7:
pass
else:
print(count)
count +=1
(3).
count=0
while count<10:
count +=1
if count==7:
continue
print(count)

    原文作者:God_with_us
    原文地址: https://www.cnblogs.com/pythonblogs/p/10990385.html
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞