•        Python : 3.7.3
  •          OS : Ubuntu 18.04.2 LTS
  •         IDE : pycharm-community-2019.1.3
  •       Conda : 4.7.5
  •    typesetting : Markdown

code

coder@ubuntu:~$ source activate py37
(py37) coder@ubuntu:~$ ipython
Python 3.7.3 (default, Mar 27 2019, 22:11:17)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.5.0 -- An enhanced Interactive Python. Type '?' for help. In [1]: t = True In [2]: f = False In [3]: 1 + t
Out[3]: 2 In [4]: 1 - t
Out[4]: 0 In [5]: 1 + f
Out[5]: 1 In [6]: 1 / f
---------------------------------------------------------------------------
ZeroDivisionError Traceback (most recent call last)
<ipython-input-6-99618acd2739> in <module>
----> 1 1 / f ZeroDivisionError: division by zero In [7]: exit
(py37) coder@ubuntu:~$ conda deactivate
coder@ubuntu:~$

source_code


class bool(int):
"""
bool(x) -> bool Returns True when the argument x is true, False otherwise.
The builtins True and False are the only two instances of the class bool.
The class bool is a subclass of the class int, and cannot be subclassed.
"""
def __and__(self, *args, **kwargs): # real signature unknown
""" Return self&value. """
pass def __init__(self, x): # real signature unknown; restored from __doc__
pass @staticmethod # known case of __new__
def __new__(*args, **kwargs): # real signature unknown
""" Create and return a new object. See help(type) for accurate signature. """
pass def __or__(self, *args, **kwargs): # real signature unknown
""" Return self|value. """
pass def __rand__(self, *args, **kwargs): # real signature unknown
""" Return value&self. """
pass def __repr__(self, *args, **kwargs): # real signature unknown
""" Return repr(self). """
pass def __ror__(self, *args, **kwargs): # real signature unknown
""" Return value|self. """
pass def __rxor__(self, *args, **kwargs): # real signature unknown
""" Return value^self. """
pass def __str__(self, *args, **kwargs): # real signature unknown
""" Return str(self). """
pass def __xor__(self, *args, **kwargs): # real signature unknown
""" Return self^value. """
pass

resource

  • [文档 - English] docs.python.org/3
  • [文档 - 中文] docs.python.org/zh-cn/3
  • [规范] www.python.org/dev/peps/pep-0008
  • [规范] zh-google-styleguide.readthedocs.io/en/latest/google-python-styleguide/python_language_rules
  • [源码] www.python.org/downloads/source
  • [ PEP ] www.python.org/dev/peps
  • [平台] www.cnblogs.com
  • [平台] gitee.com


Python具有开源、跨平台、解释型、交互式等特性,值得学习。

Python的设计哲学:优雅,明确,简单。提倡用一种方法,最好是只有一种方法来做一件事。

代码的书写要遵守规范,这样有助于沟通和理解。

每种语言都有独特的思想,初学者需要转变思维、踏实践行、坚持积累。

Python3基础 bool True为1 False为0的更多相关文章

  1. Python3基础 bool类型变量赋值

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

  2. Python3基础 dict 推导式 生成10以内+奇数的值为True 偶数为False的字典

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

  3. js bool true false 比较

    .想到一个好玩的,运行如下 javascript :  if ('0') alert("'0' is true");  if ('0' == false) alert(" ...

  4. Python3中真真假假True、False、None等含义详解

    概述 在Python中,不仅仅和类C一样的真假类似,比如1代表真,0代表假.Python中的真假有着更加广阔的含义范围,Python会把所有的空数据结构视为假,比如[](空列表).{}(空集合).'' ...

  5. Python3基础 filter()第一个参数为NONE时 结果只返回为True的对象

    镇场诗: 诚听如来语,顿舍世间名与利.愿做地藏徒,广演是经阎浮提. 愿尽吾所学,成就一良心博客.愿诸后来人,重现智慧清净体.-------------------------------------- ...

  6. 【python3基础】python3 神坑笔记

    目录 os 篇 os.listdir(path) 运算符篇 is vs. == 实例 1:判断两个整数相等 实例 2:argparse 传参 实例 3:np.where 命令行参数篇 Referenc ...

  7. Invalidate(TRUE)与Invalidate(FALSE)区别(前者会发送WM_ERASEBKGND消息全部刷新,然后使用WM_PAINT消息绘制,而后者只发送WM_PAINT消息)

    使用Invalidate(TRUE)函数时,它会向消息队列中添加了WM_ERASEBKGND和WM_PAINT两个消息. 使用Invalidate(FALSE)函数时,它只会向消息队列中添加了WM_P ...

  8. python3 基础数据类型

    一.基础数据类型分类 python的数据类型主要包括以下几种: 1.数字 2.字符串 3.列表 4.字典 5.元组 6.集合 1.数字 int 数字主要是用于计算用的,使用方法并不多 #bit_len ...

  9. python002 Python3 基础语法

    python002 Python3 基础语法 编码默认情况下,Python 3 源码文件以 UTF-8 编码,所有字符串都是 unicode 字符串. 当然你也可以为源码文件指定不同的编码: # -* ...

随机推荐

  1. Makefile学习一

    上次随着信号学习告一段落,也标志着linux系统编程相关的知识学完了,而学了这么多知识点,是需要用一个综合的项目来将其进行串起来的,这样学习的技术才会不那么空洞,所以接下来会以一个实际例子来综合运用下 ...

  2. MySQL中的char与varchar详解

    mysql中char与varchar的区别: char:定长,效率高,一般用于固定长度的表单提交数据存储  :例如:身份证号,手机号,电话,密码等 varchar:不定长,效率偏低 1.varchar ...

  3. 1216 Vue基础

    目录 前端框架 Vue 1.简介 1.1 优点 2 使用 2.1 基础 2.2 文本指令 2.3 事件指令 2.4 属性指令 JS面向对象补充 前端框架 angular ---更新程度太快,且不向下兼 ...

  4. 《hello-world》第九次团队作业:【Beta】Scrum meeting 1

    项目 内容 这个作业属于哪个课程 2016级计算机科学与工程学院软件工程(西北师范大学) 这个作业的要求在哪里 实验十三 团队作业9:Beta冲刺与团队项目验收 团队名称 <hello--wor ...

  5. 神经网络MNIST数据集分类tensorboard

    今天分享同样数据集的CNN处理方式,同时加上tensorboard,可以看到清晰的结构图,迭代1000次acc收敛到0.992 先放代码,注释比较详细,变量名字看单词就能知道啥意思 import te ...

  6. vue-cli 3 按需引入 element-ui

    1.安装按需引入必要插件 npm install babel-plugin-component --save-dev 2.修改babel.config.js 3.在main.js中引入用到的组件,例如 ...

  7. LG5325 【模板】Min_25筛

    P5325 [模板]Min_25筛 题目背景 模板题,无背景. 题目描述 定义积性函数$f(x)$,且$f(p^k)=p^k(p^k-1)$($p$是一个质数),求 $$\sum_{i=1}^n f( ...

  8. Codeforces Round #604 (Div. 2) C. Beautiful Regional Contest

    链接: https://codeforces.com/contest/1265/problem/C 题意: So the Beautiful Regional Contest (BeRC) has c ...

  9. php 程序执行时间检测

    我们有的时经常需要做程序的执行时间执行效率判断.大理石平台检定规程 实现的思路如下: <?php //记录开始时间 //记录结整时 // 开始时间  减去(-)  结束时间  得到程序的运行时间 ...

  10. Linux 内存Cache和Buffer理解

    在 Linux 系统中,我们经常用 free 命令来查看系统内存的使用状态.在一个 RHEL6 的系统上,free 命令的显示内容大概是这样一个状态:   [root@tencent64 ~]# fr ...