doraemon的python之旅 整型、布尔值和字符串1

运算补充

1.in  和 not in #判断某个东西是否在里面

content = input"请输入内容:"

if "sex" in content:

  print("包含敏感字符")

while True:

  content = input"请输入内容:"

  if "sex" in content:

    print("包含敏感字符")

  else:

  print(content)

  break

2.优先级

not 2>1

解读: not 2       >1    #错误

      not     2>1       #正确     not and or  是所有运算符号里最低级的

猜你喜欢

转载自www.cnblogs.com/doraemon548542/p/11067145.html