1.文档资源列表
形式 |
角色 |
#注释 |
文件中的文档 |
dir函数 |
对象中可用属性列表 |
文档字符串:__doc__ |
附近在对象上的文档 |
pydoc:help() |
对象的交互帮助 |
pydoc:html报表 |
浏览器中的模块文档 |
标准手册 |
正式的语音和库的说明 |
网站资源 |
在线教程、例子等 |
出版的书籍 |
商业参考书籍 |
2.注释
使用#号注释,一般用来说明小功能,如果较大型的功能,一般使用文档字符串
>>> aList=[]#新建一个列表
3.dir()
内建函数dir()抓取对象内可用所有属性列表的简单方式
>>> import sys
>>> dir(sys)
['__displayhook__', '__doc__', '__excepthook__', '__interactivehook__', '__loader__', '__name__', '__package__', '__spec__', '__stderr__', '__stdin__', '__stdout__', '_clear_type_cache', '_current_frames', '_debugmallocstats', '_getframe', '_home', '_mercurial', '_xoptions', 'api_version', 'argv', 'base_exec_prefix', 'base_prefix', 'builtin_module_names', 'byteorder', 'call_tracing', 'callstats', 'copyright', 'displayhook', 'dllhandle', 'dont_write_bytecode', 'exc_info', 'excepthook', 'exec_prefix', 'executable', 'exit', 'flags', 'float_info', 'float_repr_style', 'getallocatedblocks', 'getcheckinterval', 'getdefaultencoding', 'getfilesystemencoding', 'getprofile', 'getrecursionlimit', 'getrefcount', 'getsizeof', 'getswitchinterval', 'gettrace', 'getwindowsversion', 'hash_info', 'hexversion', 'implementation', 'int_info', 'intern', 'maxsize', 'maxunicode', 'meta_path', 'modules', 'path', 'path_hooks', 'path_importer_cache', 'platform', 'prefix', 'setcheckinterval', 'setprofile', 'setrecursionlimit', 'setswitchinterval', 'settrace', 'stderr', 'stdin', 'stdout', 'thread_info', 'version', 'version_info', 'warnoptions', 'winver']
>>>
如果需要找出对象提供的属性与方法,我们可以传入一个空的对象,如:
>>> dir(())
['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'count', 'index']
>>> dir([])
['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']
>>> dir('')
['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']
>>>
或者我们也可以传递这个对象的名字:
>>> dir(str)==dir('')
True
>>> dir(list)==dir([])
True
>>>
总结,这一章节主要列举了文档资源,并且简单说明了一下注释和dir函数
这一章节就说到这里,谢谢大家
------------------------------------------------------------------
点击跳转零基础学python-目录
版权声明:本文为博主原创文章,未经博主允许不得转载。
分享到:
相关推荐
python 零基础学习篇-Python-第八章:文件的使用1.mp3
python 零基础学习篇-Python-第八章:文件的使用2-12.mp3
python 零基础学习篇-Python-第七章:函数的设计和使用1-3.mp3
python 零基础学习篇-Python-第七章:函数的设计和使用4-9.mp3
Python3编写实用脚本程序——从零学Python-掘金活动.zip Python3编写实用脚本程序——从零学Python-掘金活动.zip Python3编写实用脚本程序——从零学Python-掘金活动.zip Python3编写实用脚本程序——从零学Python-...
python-gtk 2013年7月31日 python入门基础教程:python-gtk全文共15页,当前为第1页。 安装 sudo aptitude install python-gtk2 文档 ...
零基础学python 1.7 第二个程序
python 零基础学习篇-2、第二章:系统架构设计的案例分析1-27.mp3
libselinux-python-2.5-14.1.el7.x86_64.rpm python-IPy-0.75-6.el7.noarch.rpm docker-ce-cli-19.03.8-3.el7.x86_64.rpm checkpolicy-2.5-8.el7.x86_64.rpm policycoreutils-python-2.5-33.el7.x86_64.rpm ...
hadoop-yarn-api-python-client 适用于ApacheHadoop:registered:YARN API的Python客户端 软件包文档: REST API文档: 兼容性库与Apache Hadoop 3.2.1兼容。 如果您使用的版本不是上述版本(或类似Hortonworks的供应...
【Python3】零基础入门学习Python--Python3.docx
资源分类:Python库 所属语言:Python 资源全名:executor-14.1-py2.py3-none-any.whl 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
零基础入门学习Python-价值200的鱼C论坛教程
python 零基础学习篇-Python-第一章 Python入门导入1-3.mp3
python免费课件-零基础python⼊门(含课件代码)PDF⾼清 版 给⼤家带来的⼀篇关于python相关的电⼦⽂档资源,介绍了关于python⼊门、python基础⽅⾯的内容,本书是由python官⽅出版,格式 为PDF,资源⼤⼩61 MB,⽥...
python-pptx库英文文档完整版,本站第一个发布。 不管你爱不爱,Powerpoint都被广泛应用于商务场合。文章不会争辩Powerpoint的优点,而是向你展示如何用Python使创建Powerpoint幻灯片自动化,以便去除掉在使用...
python 零基础学习篇-Python-第六章 字符串1-3.mp3
python 零基础学习篇-Python-第三章 使用序列1-12.mp3
python 零基础学习篇-Python-第二章 顺序程序设计9-12.mp3