python函数手册中文,python函数中文手册.doc

[摘要]内置函数 文档说明 原始文档来自于python v2.7.2 中文译文和用法尚不完全,您可以自由修改和完善, 您可以在文档结尾鸣谢添上您的名字,我们将会感谢您做的 贡献! 二,函数列表 1,取绝对值 abs(x) Return the absolute value of a number. The argument may be a plain or long integer or a floating point number. If the argument is a complex number, its magnitude is returned. 如果你不知道绝对值什么意思,那就要补一下小学数学了! 基本用法 2, all(iterable) Return True if all elements of the iterable are true (or if the iterable is empty). Equivalent to: 3. any(iterable) Return True if any element of the iterable is true. If the iterable is empty, return False. Equivalent to: 4. basestring() This abstract type is the superclass for str and unicode. It cannot be called or instantiated, but it can be used to test whether an object is an instance of str or unicode. isinstance(obj, basestring) is equivalent to isinstance(obj, (str, unicode)). 是字符串和字符编码的超类,是抽象类型。

不能被调用或者实例化。

可以用来判断实例是否为字符串或者字符编码。

方法: 5.二进制转换 bin(x) Convert an integer number to a binary string. The result is a valid Python expression. If x is not a Python int object, it has to define an __index__() method that returns an integer. 转换成二进制表达 方法: 6.布尔类型 bool([x]) Convert a value to a Boolean, using the standard truth testing procedure. If x is false or omitted, this returns False; otherwise it returns True. bool is also a class, which is a subclass of int. Class bool cannot be subclassed further. Its only instances are False and True 布尔类型的转化 用法: 7. 二进制数组的转化 bytearray([source[, encoding[, errors]]]) Return a new array of bytes. The bytearray type is a mutable sequence of integers in the range 0 <= x < 256. It has most of the usual methods of mutable sequences, described in Mutable Sequence Types, as well as most methods that the str type has, see String Methods. The optional source parameter can be used to initialize the array in a few different ways: If it is a string, you must also give the encoding (and optionally, errors) parameters; bytearray() then converts the string to bytes using str.encode(). If it is an integer, the ar

d5aeb6d88e7466732da94c6ceb29ab8c.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
前言 本书的读者 本书的由来 本书目前的状况 官方网站 约定条款 欢迎给我反馈 值得思考的一些东西 1. 介绍 简介 Python的特色 概括 为什么不使用Perl? 程序员的话 2. 安装Python Linux和BSD用户 Windows®用户 概括 3. 最初的步骤 简介 使用带提示符的解释器 挑选一个编辑器 使用源文件 输出 它如何工作 可执行的Python程序 获取帮助 概括 4. 基本概念 字面意义上的常量 数 字符串 变量 标识符的命名 数据类型 对象 输出 它如何工作 逻辑行与物理行 缩进 概括 5. 运算符与表达式 简介 运算符 运算符优先级 计算顺序 结合规律 表达式 使用表达式 概括 6. 控制流 简介 if语句 使用if语句 它如何工作 while语句 使用while语句 for循环 使用for语句 break语句 使用break语句 continue语句 使用continue语句 概括 7. 函数 简介 定义函数 函数形参 使用函数形参 局部变量 使用局部变量 使用global语句 默认参数值 使用默认参数值 关键参数 使用关键参数 return语句 使用字面意义上的语句 DocStrings 使用DocStrings 概括 8. 模块 简介 使用sys模块 字节编译的.pyc文件 from..import语句 模块的__name__ 使用模块的__name__ 制造你自己的模块 创建你自己的模块 from..import dir()函数 使用dir函数 概括 9. 数据结构 简介 列表 对象与类的快速入门 使用列表 元组 使用元组 元组与打印语句 字典 使用字典 序列 使用序列 参考 对象与参考 更多字符串的内容 字符串的方法 概括 10. 解决问题——编写一个Python脚本 问题 解决方案 版本一 版本二 版本三 版本四 进一步优化 软件开发过程 概括 11. 面向对象的编程 简介 self 类 创建一个类 对象的方法 使用对象的方法 __init__方法 使用__init__方法 类与对象的变量 使用类与对象的变量 继承 使用继承 概括 12. 输入/输出 文件 使用文件 储存器 储存与取储存 概括 13. 异常 错误 try..except 处理异常 引发异常 如何引发异常 try..finally 使用finally 概括 14. Python标准库 简介 sys模块 命令行参数 更多sys的内容 os模块 概括 15. 更多Python的内容 特殊的方法 单语句块 列表综合 使用列表综合 在函数中接收元组和列表 lambda形式 使用lambda形式 exec和eval语句 assert语句 repr函数 概括 16. 接下来学习什么? 图形软件 GUI工具概括 探索更多内容 概括 A. 自由/开放源码软件(FLOSS) B. 关于本书 后记 关于作者 关于译者 关于简体中文译本 C. 修订记录 时间表 术语表 表格5.1 运算符与它们的用法 5.2 运算符优先级 15.1 一些特殊的方法 例子3.1 使用带提示符的Python解释器 3.2 使用源文件 4.1 使用变量和字面意义上的常量 5.1 使用表达式 6.1 使用if语句 6.2 使用while语句 6.3 使用for语句 6.4 使用break语句 6.5 使用continue语句 7.1 定义函数 7.2 使用函数形参 7.3 使用局部变量 7.4 使用global语句 7.5 使用默认参数值 7.6 使用关键参数 7.7 使用字面意义上的语句 7.8 使用DocStrings 8.1 使用sys模块 8.2 使用模块的__name__ 8.3 如何创建你自己的模块 8.4 使用dir函数 9.1 使用列表 9.2 使用元组 9.3 使用元组输出 9.4 使用字典 9.5 使用序列 9.6 对象与参考 10.1 备份脚本——版本一 10.2 备份脚本——版本二 10.3 备份脚本——版本三(不工作!) 10.4 备份脚本——版本四 11.1 创建一个类 11.2 使用对象的方法 11.3 使用__init__方法 11.4 使用类与对象的变量 11.5 使用继承 12.1 使用文件 12.2 储存与取储存 13.1 处理异常 13.2 如何引发异常 14.1 使用sys.argv 15.1 使用列表综合 15.2 使用lambda形式
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值