在Windows中,Python有一个chm类型的文档,阅读起来非常方便.但在Linux中,是否有任何文件让我阅读?
Mar*_*oma 19
最简单的方法是使用Google访问在线文档.没有一点可以找到所有模块的所有文档.但是,一些常见的是:
如果您需要离线文档,还有其他一些可能性:
您可以将文档下载为HTML或PDF:https://docs.python.org/3/download.html
当您运行Web服务器时,您可以使用HTML版本并通过浏览器访问它.HTML网站看起来就像你习惯的那样.即使搜索也可以脱机,因为它是用JavaScript实现的.

像Debian这样的一些发行版提供了一个python-doc包.您可以通过pydoc -p [some port number]或通过访问它
pydoc -g.这将创建一个本地Web服务器.然后,您可以打开浏览器并查看它:
Python交互式控制台具有内置help(...)系统.您可以在没有参数的情况下调用它:
$ python
Python 2.7.5+ (default, Feb 27 2014, 19:37:08)
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> help()
Welcome to Python 2.7! This is the online 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/2.7/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, or topics, type "modules",
"keywords", or "topics". Each module also comes with a one-line summary
of what it does; to list the modules whose summaries contain a given word
such as "spam", type "modules spam".
help>
Run Code Online (Sandbox Code Playgroud)
或者你可以用一个你想知道的东西来调用它.这可以是任何东西(模块,类,函数,对象......).它看起来像这样:
>>> a = {'b':'c'}
>>> help(a)
Help on dict object:
class dict(object)
| dict() -> new empty dictionary
| dict(mapping) -> new dictionary initialized from a mapping object's
| (key, value) pairs
| dict(iterable) -> new dictionary initialized as if via:
| d = {}
| for k, v in iterable:
| d[k] = v
| dict(**kwargs) -> new dictionary initialized with the name=value pairs
| in the keyword argument list. For example: dict(one=1, two=2)
|
| Methods defined here:
|
| __cmp__(...)
| x.__cmp__(y) <==> cmp(x,y)
|
| __contains__(...)
| D.__contains__(k) -> True if D has a key k, else False
|
| __delitem__(...)
| x.__delitem__(y) <==> del x[y]
|
| __eq__(...)
| x.__eq__(y) <==> x==y
|
| __ge__(...)
| x.__ge__(y) <==> x>=y
|
| __getattribute__(...)
| x.__getattribute__('name') <==> x.name
|
| __getitem__(...)
| x.__getitem__(y) <==> x[y]
|
| __gt__(...)
: (scroll)
Run Code Online (Sandbox Code Playgroud)
http://www.google.cz/search?q=linux+chm+viewer
这些文档有各种格式:http: //docs.python.org/download.html
有一个python文档服务器,您可以在本地运行:http://docs.python.org/library/pydoc.html?highlight = pydoc #pydoc
如果你使用Fedora发行版,那么yum install python-docs.其他发行版可能提供类似的包.
您还可以安装 Ipython 以交互模式检查模块/对象。
例如,您可以在 ipython 中执行此操作:
import pygame
pygame.draw.line?
Run Code Online (Sandbox Code Playgroud)
然后你得到结果文档:
pygame.draw.line(Surface, color, start_pos, end_pos, width=1): 返回 Rect
绘制直线段
在 ipython 中,您可以使用制表符补全,这对于检查某些内容很有帮助。
| 归档时间: |
|
| 查看次数: |
12663 次 |
| 最近记录: |