Python3基础-语言内置
来源:互联网 发布:软件著作权转让 编辑:程序博客网 时间:2024/06/06 09:34
Python3基础-语言内置
节选自Python文档的Library Reference部分,位置:
Python » 3.4.3 Documentation » The Python Standard Library »
Built-in Functions 内置函数
部分例如:
Built-in Constants 内置常量
- True
- False
- None
- NotImplemented
- 等
Built-in Types 内置类型
Truth Value Testing真值测试
下面的值被当作false看待:
None
False
- zero of any numeric type, for example,
0
,0.0
,0j
. - any empty sequence, for example,
''
,()
,[]
. - any empty mapping, for example,
{}
. - 等
Boolean Operations布尔操作
- or
- and
- not
Comparisons比较
Numeric Types — int, float, complex 三种数值类型
三种数值类型: integers整数, floating point numbers浮点数, and complex numbers复数. In addition, Booleans are a subtype of integers.
The constructors int()
, float()
, and complex()
can be used to produce numbers of a specific type.
Bitwise Operations on Integer Types
作用于整数上的位运算:
Iterator Types 迭代器类型
略
Sequence Types — list, tuple, range 三种序列类型
class list([iterable])
Lists may be constructed in several ways:
- Using a pair of square brackets to denote the empty list:
[]
- Using square brackets, separating items with commas:
[a]
,[a, b, c]
- Using a list comprehension:
[x for x in iterable]
- Using the type constructor:
list()
orlist(iterable)
class tuple([iterable])
Tuples may be constructed in a number of ways:
- Using a pair of parentheses to denote the empty tuple:
()
- Using a trailing comma for a singleton tuple:
a,
or(a,)
- Separating items with commas:
a, b, c
or(a, b, c)
- Using the tuple() built-in:
tuple()
ortuple(iterable)
class range(start, stop[, step])
例:
>>> list(range(0, 10, 3))[0, 3, 6, 9]
Text Sequence Type — str 文本序列类型
- Single quotes: ‘allows embedded “double” quotes’
- Double quotes: “allows embedded ‘single’ quotes”.
- Triple quoted: ”’Three single quotes”’, “”“Three double quotes”“”
Binary Sequence Types — bytes, bytearray, memoryview 三种二进制序列类型
略
Set Types — set, frozenset 两种集合类型
略
Mapping Types — dict 映射类型
略
Built-in Exceptions 内置异常
略
0 0
- Python3基础-语言内置
- python3语言的基础学习
- 基础程序教学教程【语言:python3.4】
- C++语言基础 例程 内置函数
- Python3 -1-内置数据类型
- python3 内置函数大全
- Python3.4内置函数
- python3内置函数详解
- Python3内置函数
- python3内置方法列表
- Python3常用内置函数
- Python3.5 内置函数
- python3 内置函数
- Python3 内置函数
- python3内置函数学习
- python3内置方法
- Python3之内置函数
- Python3 内置函数
- Android访问Https双向认证API
- 安卓分分钟搞定ListView单选问题
- 让手机状态栏随心所欲的改变颜色,即android的沉浸式状态栏
- 单例模式最简洁全面的介绍
- 一个简单的错误,关于bootstrap模态框挡住了按钮。
- Python3基础-语言内置
- Leetcode:Missing Number & Maximum Product of Word Lengths
- 一些简单的Python测试题
- MySQL中select * for update锁表的问题
- ExtJS5 - 使用vtype自定义表单域的验证规则
- Android控件之AutoCompleteTextView
- 剑指offer第三十四题【数字在排序数组中出现的次数】c++实现
- LayoutInflater中的inflate方法详解(转载整理)
- android中SQLite数据库操作