Python - 获取帮助信息
1- Python Manuals
自带CHM格式的Python Manuals存放在\Python<x.x>\Doc\目录下。
可以在IDLE界面下按F1键或点击help选项下Python Docs标签打开;也可以在通过“开始 ---》python x.x ---》Python Manuals”打开。
2- Module Docs
包含了python中所有内置的和已经安装的第三方Modules文档信息
通过“开始 ---》python x.x ---》Module Docs”打开,出现pydoc程序界面,可以在搜索框直接查找需要的内容。
也可以点击“open browser”建立本地临时的web server,浏览网页版的文档信息。需要关闭时,点击“quit serving”即可。
利用pydoc手工在指定端口打开web documentation server
python -m pydoc -p 6789 (表示打开pydoc模块来查看python文档,并在6789端口上启动web server)
然后访问http://localhost:6789/,可以看到所有已经安装的Modules文档信息。需要关闭时,按“ctrl+c”可以终止命令或者关闭命令界面即可。
利用pydoc在终端下查看模块文档信息
查看os模块文档 python -m pydoc <xxx>
在当前目录生成模块的HTML文档 python -m pydoc -w <xxx>
在Linux下同样适用pydoc方式查看文档。
3- help()和dir()
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.
- 查看对象信息:help([object])
- 查看所有的keyword:help("keywords")
- 查看所有的modules:help("modules")
- 查看常见的topics: help("topics")
- 查看模块,例如:help("sys")
- 查看数据类型,例如: help("list")
- 查看数据类型的成员方法,例如: help("list.append")
对于已定义或引入的对象,help([object])查询不使用单引号和双引号。对于未引入的模块等对象,要使用单引号或双引号。
dir([object])
Without arguments, return the list of names in the current local scope. With an argument, attempt to return a list of valid attributes for that object.
查看当前属性及方法:dir()
查看对象的属性及方法:>dir([object])
dir([object]) 查询不使用单引号和双引号。
注意:
help()函数多用来查看对象的详细说明,按q键退出。dir()函数多用来查看对象的属性方法,输出的是列表。
使用help()和dir()之前,确定查询的对象已被定义或引入,否则会报错:“NameError: name is not defined”。
4- 官方在线文档
www.python.org/doc
5- 搜索与请教
Google、百度、必应、牛人等等
Python - 获取帮助信息的更多相关文章
- python 获取对象信息
当我们拿到一个对象的引用时,如何知道这个对象是什么类型.有哪些方法呢? 使用type() 首先,我们来判断对象类型,使用type()函数: 基本类型都可以用type()判断: >>> ...
- Python 获取车票信息
提示:该代码仅供学习使用,切勿滥用!!! 先来一个git地址:https://gitee.com/wang_li/li_wang 效果图: 逻辑: 1.获取Json文件的内容 2.根据信息生成URL ...
- 用python获取服务器硬件信息[转]
#!/usr/bin/env python # -*- coding: utf-8 -*- import rlcompleter, readline readline.parse_and_bind(' ...
- 用python获取ip信息
1.138网站 http://user.ip138.com/ip/首次注册后赠送1000次请求,API接口请求格式如下,必须要有token值 import httplib2 from urllib.p ...
- python获取对象信息
获取对象信息 拿到一个变量,除了用 isinstance() 判断它是否是某种类型的实例外,还有没有别的方法获取到更多的信息呢? 例如,已有定义: class Person(object): def ...
- python获取机器信息脚本(网上寻找的)
获取机器信息(待测试) # -*- coding: UTF-8 -*- import psutil import json import os import socket import struct ...
- python获取的信息列表微信公共平台和用户头像
转载注明原文地址:http://blog.csdn.net/btyh17mxy/article/details/25207889 只写模拟登陆的方式获取微信从信息和头像库列表公共平台, - 相关后,功 ...
- 关于Python 获取windows信息收集
收集一些Python操作windows的代码 (不管是自带的or第三方库)均来自网上 1.shutdown 操作 定时关机.重启.注销 #!/usr/bin/python #-*-coding:utf ...
- python 获取SLB信息 更换证书
首先安装阿里云SDK pip install aliyun-python-sdk-core pip install aliyun-python-sdk-slb 可以配合jenkins传递参数 #获取s ...
随机推荐
- APK重签名总结
keytool -genkey -alias aeo_android.keystore -keyalg RSA -validity 20000 -keystore aeo_android.keysto ...
- .NET错误The 'targetFramework' attribute in the <compilation> element of the Web.config file is used only to target version 4.0 and later of the .NET Framework
错误描述: The 'targetFramework' attribute in the <compilation> element of the Web.config file is u ...
- python排序算法的实现-冒泡
1.算法描述: (1)共循环 n-1 次 (2)每次循环中,如果 前面的数大于后面的数,就交换 (3)设置一个标签,如果上次没有交换,就说明这个是已经好了的. 2.代码 #!/usr/bin/pyth ...
- Erwin 生成 mysql 带注释(comment )的脚本
Erwin设计数据库非常方便,有逻辑视图和物理视图,可以很方便的生成数据库文档和SQL 脚本.在使用过程中唯一不爽的地方是脚本不能生成comment. 在百度无数次无法解决下,又FQ谷歌,在一个日 ...
- C#标准响应数据
public HttpResponseMessage UpdateModule(Mode mode) { var response = Process.Instance.ExecuteString(( ...
- 2014年黑金FPGA原创教程规划发布
2014年已经过去快一半了,才出黑金2014年的FPGA原创教程规划,有点对不起大家了,哈哈! 俗话说,亡羊补牢,为时不晚,希望大家谅解啊,对于大家的支持,我们黑金人一向是感激.感恩.感谢! 下面大概 ...
- 阅读《Effective C++》系列
<Effective C++>条款07:为多态基类声明virtual析构函数 这样做主要是为了防止内存泄漏,见我hexo博客. C++的虚析构函数 <Effective C++> ...
- mysql用shell建100多字段表并导入
excel列超过160多个,导入时报错,把excel第一行另存为逗号分隔的csv文件,用shell建表 vim createTable.sh #!/bin/sh str="CA6430M,H ...
- Windows2008 R2下,DCOM配置里的属性灰色不可用的解决方法
错误为:为应用程序池“XXXXXX”提供服务的进程在与“Windows Process Activation Service”通信时出现严重错误.该进程 ID 为"XXX".数据字 ...
- win2008远程桌面会话数增加
1.[解决]由于没有远程桌面授权服务器可以提供许可证,远程回话被中断 你看到的这个文章来自于http://www.cnblogs.com/ayanmw 由于windows server 2008 R2 ...