一、布尔运算符

1、x and y: if x is false, then x, else  y

2、x or y: if x is false, then y, else x

3、not x: if x is false, then true, else false

二、运算结果

>>> 'a' and 'b'
'b' >>> '' and 'b'
'' >>> 'a' or 'b'
'a' >>> '' or 'b'
'b' >>> not 'a'
False >>> not ''
True

Python-Boolean operation的更多相关文章

  1. Python & file operation mode

    Python & file operation mode create/read/write/append mode https://docs.python.org/3/library/fun ...

  2. python file operation

    file.open(name[,mode[,buffering]]) 模式的类型有: r 默认只读 w     以写方式打开,如果文件不存在则会先创建,如果文件存在则先把文件内容清空(truncate ...

  3. Python dict operation introduce

    字典是另一种可变容器模型,且可存储任意类型对象. 字典的每个键值(key=>value)对用冒号(:)分割,每个对之间用逗号(,)分割,整个字典包括在花括号({})中 ,格式如下所示: d = ...

  4. Python DB operation

    mysql http://www.cnblogs.com/zhangzhu/archive/2013/07/04/3172486.html 1.连接到本机上的MYSQL.首先打开DOS窗口,然后进入目 ...

  5. [Python] Boolean Or "Mask" Index Arrays filter with numpy

    NumPy Reference: Indexing Integer array indexing Boolean array indexing Note: The expression a < ...

  6. [算法]Comparison of the different algorithms for Polygon Boolean operations

    Comparison of the different algorithms for  Polygon Boolean operations. Michael Leonov 1998 http://w ...

  7. Thread: BooleanRT : Realtime 3D boolean operations for (Runtime,Editor)

    A Product by Mixed Dimensions What is BooleanRT? BooleanRT is a real-time 3D boolean operations exte ...

  8. Python - 2. Built-in Collection Data Types

    From: http://interactivepython.org/courselib/static/pythonds/Introduction/GettingStartedwithData.htm ...

  9. Python Base Four

    35. In python, file operation syntax is similar to c. open(file,'r',……) //the first parameters is ne ...

  10. Boolean operations between triangle meshes

    Boolean operations between triangle meshes eryar@163.com Abstract. Boolean operations is one of basi ...

随机推荐

  1. 解读人:范徉,Methylome and Metabolome Analyses Reveal Adaptive Mechanisms in Geobacter sulfurreducens Grown on Different Terminal Electron Acceptors(甲基化组学和代谢组学分析发现Geobacter sulfurreducens生长在不同电子终受体中的适应机制)

    发表时间: (2019年4月) IF:3.950 单位: Fujian Provincial Key Laboratory of Soil Environmental Health and Regul ...

  2. IE浏览器不支持Promise对象

    1. 安装babel-polyfill插件转换 npm install --save-dev babel-polyfill 2. 在webpack中引入babel-polyfill 在webpack. ...

  3. element input搜索框探索

    转(https://blog.csdn.net/qq_37746973/article/details/78402812) 在script中添加下面两个函数 //queryString 为在框中输入的 ...

  4. React的核心概念

    1.JSX的语法(javascript和XML结合的语法) 2.元素渲染(页面渲染) 3.组件 创建组件和组件之间传参 4.props属性 是父元素(父组件传递给子组件的值)和state状态(子组件自 ...

  5. Chapter10

    package scala import java.io.{PrintStream, PrintWriter}import java.util.Date import scala.util.loggi ...

  6. spring运用的设计模式

    1.代理模式(典型的aop) 2.工厂模式(beanFactory) 3.观察者模式(ApplicationContextEvent && ApplicationContextList ...

  7. css 选择器 & UI元素的伪类选择器 & 伪元素选择器

    UI元素的伪类选择器 1. :focus  用来选取获取焦点事件 2. :enabled 用来指定当元素处于可用状态时的样式 3. :disable  用来指定元素处于不可用时的状态    表单里应用 ...

  8. css动画-小球撞壁反弹

    小球碰到一面壁之后一般都会反弹,反射角=入射角: 其实用css3来实现这个效果也非常简单. 首先,分解一下小球的运动:水平运动和垂直运动. 当小球往右下方向运动时,如果碰到了下面的壁,那么由于碰撞,小 ...

  9. Python开发环境Wing IDE搜索工具介绍

    Wing IDE编辑器的搜索工具提供了一个基于友好GUI的搜索和替换工具. 某些情况下搜索可能会跨越整个文件,也有可能被限制到当前所选择的区域:可以区分大小写,也可以设置为不区分:可以被限制为只匹配整 ...

  10. Android list加载图片工具类

    总体思路 Handler + looper + message 核心类 package com.base.imagechoose.util; import android.graphics.Bitma ...