Python内置函数(39)——help
英文文档:
help([object])
Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the interactive help system starts on the interpreter console. If the argument is a string, then the string is looked up as the name of a module, function, class, method, keyword, or documentation topic, and a help page is printed on the console. If the argument is any other kind of object, a help page on the object is generated.
This function is added to the built-in namespace by the site module.
返回对象的帮助信息
说明:
1. 在解释器交互界面,不传参数调用函数时,将激活内置的帮助系统,并进入帮助系统。在帮助系统内部输入模块、类、函数等名称时,将显示其使用说明,输入quit退出内置帮助系统,并返回交互界面。
>>> help() #不带参数 Welcome to Python 3.5's help utility! If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://docs.python.org/3.5/tutorial/. Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules. To quit this help utility and
return to the interpreter, just type "quit". To get a list of available modules, keywords, symbols, or topics, type
"modules", "keywords", "symbols", or "topics". Each module also comes
with a one-line summary of what it does; to list the modules whose name
or summary contain a given string such as "spam", type "modules spam". #进入内置帮助系统 >>> 变成了 help>
help> str #str的帮助信息
Help on class str in module builtins: class str(object)
| str(object='') -> str
| str(bytes_or_buffer[, encoding[, errors]]) -> str
|
| Create a new string object from the given object. If encoding or
| errors is specified, then the object must expose a data buffer
| that will be decoded using the given encoding and error handler.
| Otherwise, returns the result of object.__str__() (if defined)
| or repr(object).
| encoding defaults to sys.getdefaultencoding().
| errors defaults to 'strict'.
|
| Methods defined here:
|
| __add__(self, value, /)
| Return self+value.
................................ help> 1 #不存在的模块名、类名、函数名
No Python documentation found for '1'.
Use help() to get the interactive help utility.
Use help(str) for help on the str class. help> quit #退出内置帮助系统 You are now leaving help and returning to the Python interpreter.
If you want to ask for help on a particular object directly from the
interpreter, you can type "help(object)". Executing "help('string')"
has the same effect as typing a particular string at the help> prompt. # 已退出内置帮助系统,返回交互界面 help> 变成 >>>
>>>
2. 在解释器交互界面,传入参数调用函数时,将查找参数是否是模块名、类名、函数名,如果是将显示其使用说明。
>>> help(str)
Help on class str in module builtins: class str(object)
| str(object='') -> str
| str(bytes_or_buffer[, encoding[, errors]]) -> str
|
| Create a new string object from the given object. If encoding or
| errors is specified, then the object must expose a data buffer
| that will be decoded using the given encoding and error handler.
| Otherwise, returns the result of object.__str__() (if defined)
| or repr(object).
| encoding defaults to sys.getdefaultencoding().
| errors defaults to 'strict'.
|
| Methods defined here:
|
| __add__(self, value, /)
| Return self+value.
|
***************************
Python内置函数(39)——help的更多相关文章
- Python内置函数(39)——locals
英文文档: locals() Update and return a dictionary representing the current local symbol table. Free var ...
- Python 内置函数sorted()在高级用法
对于Python内置函数sorted(),先拿来跟list(列表)中的成员函数list.sort()进行下对比.在本质上,list的排序和内建函数sorted的排序是差不多的,连参数都基本上是一样的. ...
- Python内置函数和内置常量
Python内置函数 1.abs(x) 返回一个数的绝对值.实参可以是整数或浮点数.如果实参是一个复数,返回它的模. 2.all(iterable) 如果 iterable 的所有元素为真(或迭代器为 ...
- Python | 内置函数(BIF)
Python内置函数 | V3.9.1 | 共计155个 还没学完, 还没记录完, 不知道自己能不能坚持记录下去 1.ArithmeticError 2.AssertionError 3.Attrib ...
- python内置函数
python内置函数 官方文档:点击 在这里我只列举一些常见的内置函数用法 1.abs()[求数字的绝对值] >>> abs(-13) 13 2.all() 判断所有集合元素都为真的 ...
- python 内置函数和函数装饰器
python内置函数 1.数学相关 abs(x) 取x绝对值 divmode(x,y) 取x除以y的商和余数,常用做分页,返回商和余数组成一个元组 pow(x,y[,z]) 取x的y次方 ,等同于x ...
- Python基础篇【第2篇】: Python内置函数(一)
Python内置函数 lambda lambda表达式相当于函数体为单个return语句的普通函数的匿名函数.请注意,lambda语法并没有使用return关键字.开发者可以在任何可以使用函数引用的位 ...
- [python基础知识]python内置函数map/reduce/filter
python内置函数map/reduce/filter 这三个函数用的顺手了,很cool. filter()函数:filter函数相当于过滤,调用一个bool_func(只返回bool类型数据的方法) ...
- Python内置函数进制转换的用法
使用Python内置函数:bin().oct().int().hex()可实现进制转换. 先看Python官方文档中对这几个内置函数的描述: bin(x)Convert an integer numb ...
随机推荐
- Hadoop 2.6.0-cdh5.4.0集群环境搭建和Apache-Hive、Sqoop的安装
搭建此环境主要用来hadoop的学习,因此我们的操作直接在root用户下,不涉及HA. Software: Hadoop 2.6.0-cdh5.4.0 Apache-hive-2.1.0-bin Sq ...
- python引用和对象详解
python引用和对象详解 @[马克飞象] python中变量名和对象是分离的 例子 1: a = 1 这是一个简单的赋值语句,整数 1 为一个对象,a 是一个引用,利用赋值语句,引用a指向了对象1. ...
- Problem : 1412 ( {A} + {B} )
//集合中元素是不会重复的,所以完全没有必要将两个集合合并后再进行排序,交换排序的时间效率是O(n^2),将两个集合中的元素分别排序后输出即可.输出格式也非常需要 //注意的.输出一列元素赢以cout ...
- 【Unity3D与23种设计模式】策略模式(Strategy)
GoF中定义: "定义一组算法,并封装每个算法,让它们之间可以彼此交换使用. 策略模式让这些算法在客户端使用它们时能更加独立." 游戏开发过程中 不同的角色会有不同的属性计算方法 ...
- 学习 CosmosDB (NoSql)
Microsoft Azure官网 学习cosmos DB,也称作 documentDB,NoSql,不是关系型数据库,数据以Json的格式存储,灵活性强. 1.DLL 2.Connector set ...
- epel扩展库的安装
epel扩展库的安装 2017-10-09 18:07:48 个人原创,转载请注明作者,出处,否则追究法律责任 1,centos6.x系统中,必需安装epel-release-6-8.noarch. ...
- Explain
explain关键字 explain关键字一般放在SELECT查询语句的前面,用于描述MySQL如何执行查询操作.以及MySQL成功返回结果集需要执行的行数.explain 可以帮助我们分析 sele ...
- Nginx代理转发Apache+svn
1.安装svn和httpd yum install httpd yum install subversion mod_dav_svn 创建仓库目录 mkdir -p /var/www/svn 3.创建 ...
- 在Anacoda中管理多个版本Python
win10. 在cmd窗口中输入 conda info --envs 或者 conda env list 查看已经安装的环境,当前活动的环境前会加*号. 在cmd窗口(终端窗口)或anaconda p ...
- Linux下的 >, >>, <, ps, |, grep, /dev/null
1 要将命令行运行的结果保存到文件中,truncate模式下使用 >,append模式下使用 >> ls > ~/test.txt 2 要将文件中的内容作为标准输入,应使用 & ...