Python 内置函数 公共方法

for 变量 in 集合:
    
    循环体代码
else:
    没有通过 break 退出循环,循环结束后,会执行的代码

 

 

# 意思是 a 是不是不在hello里面
temp = "a" not in "hello"
print(temp)

# 意思是 a 是不是在hello里面
temp2 = "a" in "hello"
print(temp2)

 

posted @ 2021-06-05 01:30  华北业余选手  阅读(44)  评论(0)    收藏  举报