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)