python 逻辑运算符问题
1 正确
if('A' not in self.storageDevice.softVersion or\
'B' not in self.storageDevice.softVersion or\
'C' not in self.storageDevice.softVersion or\
'D' not in self.storageDevice.softVersion )
2.错误
if('A' or 'B' or 'C' or 'D' not in self.storageDevice.softVersion)
python 逻辑运算符问题的更多相关文章
- 25.Python逻辑运算符及其用法
逻辑运算符是对真和假两种布尔值进行运算(操作 bool 类型的变量.常量或表达式),逻辑运算的返回值也是 bool 类型值. Python 中的逻辑运算符主要包括 and(逻辑与).or(逻辑或)以及 ...
- python 逻辑运算符与比较运算符的差别
文章内容摘自:http://www.cnblogs.com/vamei/archive/2012/05/29/2524376.html 逻辑运算符 and, or, not 比较运算符 ==, !=, ...
- Python逻辑运算符
逻辑运算符主要用来做逻辑判断,逻辑运算符和比较运算符放一起的,同样用于条件选择和循环. 以下假设变量 a 为 10, b为 20: 示例1: #and是并且,所有的条件都是True,结果才是True: ...
- python 逻辑运算符and or
Python中逻辑运算符与C.C++.Golang等语言不太一样. 简单记录下. 1. 都是真或第一个真,第二个假 >>> a = 1 >>> b = 2 > ...
- [Python]逻辑运算符 and or
复习老男孩全栈二期视频的时候 圆号老师测试的用例两个集合and 和or操作的时候的问题 >>> a = set("what") >>> b = ...
- python逻辑运算符规则
逻辑运算符:or and not 优先级:()>not>and>or 举例子: Print(2>1 and 1<4 or 2<3 and 9>6 or 2&l ...
- python基础之逻辑运算符
python逻辑运算符: ①and ‘与’ 总结: 如果and左边为False,则直接返回左边的结果(False) 如果and左边为True,则返回的结果取决于右边的数值 ②or ‘或’ 总结: 如果 ...
- python的逻辑运算符
函数就是特殊的变量(这个变量是不加引号的) 我们 如果直接打印一个函数的名字是直接打印这个函数的内存地址 python的运算符: 首先Python的运算符和其他语言的运算符都是一样的 都有:算数运 ...
- Python之路3【第一篇】Python基础
本节内容 Python简介 Python安装 第一个Python程序 编程语言的分类 Python简介 1.Python的由来 python的创始人为吉多·范罗苏姆(Guido van Rossum) ...
随机推荐
- Vmware由于centos升级内核不可运行(C header files matching your running kernel were not found)的解决方案
C header files matching your running kernel were not found. Refer to your distribution's documentati ...
- input type=date时,时间数据回填,报错The specified value "2019-0404-18" does not conform to the required format, "yyyy-MM-dd".
<input autocomplete id="start-time" name="start_time" type="date" c ...
- CentOs7安装docker(第二篇)
一.Docker的概念: Docker: 镜像:Images 类似于面向对象中的类 容器:Container 类似于面向对象中的对象 它们之间的关系:容器Container通过镜像Images来创建 ...
- C# Note22: 《Effective C#》笔记
参考:<Effective C#>快速笔记(一)- C# 语言习惯 参考:<Effective C#>快速笔记(二)- .NET 资源托管 参考:<Effective C ...
- C# Note11:如何优雅地退出WPF应用程序
前言 I should know how I am supposed to exit my application when the user clicks on the Exit menu item ...
- 设计模式之原型模式(c++)
问题描述 看到这个模式,很容易想到小时候看的<西游记>,齐天大圣孙悟空发飙的时候可以通过自己头上的 3 根毛立马复制出来成千上万的孙悟空, 对付小妖怪很管用(数量最重要). Prototy ...
- ubuntu18.04 安装 php7.2
sudo apt-get install software-properties-common python-software-properties sudo add-apt-repository p ...
- python函数、模块、包
一.函数 定义函数: def fun_name(para_list): coding def fun_name(para_list): coding return xxx 使用函数,fun_name( ...
- 莫烦sklearn学习自修第九天【过拟合问题处理】
1. 过拟合问题可以通过调整机器学习的参数来完成,比如sklearn中通过调节gamma参数,将训练损失和测试损失降到最低 2. 代码实现(显示gamma参数对训练损失和测试损失的影响) from _ ...
- .NET提供了三种后台输出js的方式:
.NET提供了三种后台输出js的方式: 首先创建 js文件testjs.js { Page.ClientScript.RegisterClientScriptInclude("keys ...