美文网首页
python 知识点梳理

python 知识点梳理

作者: 龙小江i | 来源:发表于2018-09-19 11:48 被阅读0次

逻辑运算符

  • x and y:
    x: True ==> y
    x: False ==> x
  • x or y:
    x: True ==> x
    x: False ==> y
  • not x:
    x: True ==> False
    x False ==> True

关键字和内置函数

import keyword
keyword.kwlist

内置函数

import builtins
dir(builtins)

行输出

from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"

除法 整除 取模

# 除法
10 / 3
# 整除
10 // 3
# 取余
10 % 3

输出结果:

3.3333333333333335
3
1

缩进快捷键

TAB: 添加
SHIFT + TABLE: 删除

查找字符串里的数字

# a 是一个变量
print([i for i in a if i.isdigit()])

相关文章

网友评论

      本文标题:python 知识点梳理

      本文链接:https://www.haomeiwen.com/subject/srtinftx.html