python运算符in和not in
Posted z-j-h
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python运算符in和not in相关的知识,希望对你有一定的参考价值。
1.in: 表示连续的字符串或单个字符包含
举例
name = ‘张三四‘
# name里包含张,结果输出in if ‘张‘ in name : print(‘in‘) else: print(‘error‘)
# name里不包含张四,结果输入error if ‘张四‘ in name: print(‘in‘) else: print(‘error‘)
2.not in
# name里不包含张四,结果输出1 if ‘张四‘ not in name: print(‘1‘) else: print(‘2‘)
以上是关于python运算符in和not in的主要内容,如果未能解决你的问题,请参考以下文章
[react] Module not found: Can't resolve 'schedule' in 'C:Usersadcaldvmtn7myapp (代码片段
detectron2报AttributeError: Attribute ‘evaluator_type‘ does not exist in the metadata of dataset(代码片段
报错“Field pet in XXX.HelloController required a bean of type ‘XXX.Pet‘ that could not be found.“(代码片段
解决go: go.mod file not found in current directory or any parent directory; see ‘go help modules‘(代码片段