Python中通过help查看对象的方法描述

126 阅读1分钟
In [96]: help()                                                                 

Welcome to Python 3.8's help utility!

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at https://docs.python.org/3.8/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> list

help> tuple

help> tuple.count

help> list.extend

跳转到如下:
可以看到list对象的extend方法可以实现向list追加可以迭代的对象以扩展原list。传入的参数一个是list自身,另一个是一个可迭代的对象。

Help on method_descriptor in list:

list.extend = extend(self, iterable, /)
    Extend list by appending elements from the iterable.
(END)

按ESC,q退出查看界面

记得下方给我点赞支持哦👍👍👍
关注微信公众号“数据分析师之家
在这里插入图片描述