pydoc是Python自带的模块,主要用于从python模块中自动生成文档,这些文档可以基于文本呈现的、也可以生成WEB 页面的,还可以在服务器上以浏览器的方式呈现!
windows powershell:
> python -m pydoc input Help on built-in function input in module __builtin__: input(...) input([prompt]) -> value Equivalent to eval(raw_input(prompt)).
linux:
$ pydoc input
pydoc help:
> python -m pydoc input Help on built-in function input in module __builtin__: input(...) input([prompt]) -> value Equivalent to eval(raw_input(prompt)).
给定的端口启动HTTP
python -m pydoc -p 1234 #比如说: 端口为1234 pydoc server ready at http://localhost:1234/ pydoc server stopped
参数 -k 在所有可用的模块中按关键字搜索
> python -m pydoc -k os _locale - Support for POSIX locales. _osx_support - Shared OS X support functions. binhex - Macintosh binhex compression/decompression. codeop - Utilities to compile possibly incomplete Python source code. commands - Execute shell commands via os.popen() and return status, output. custom_tools.post_install encodings.palmos - Python Character Mapping Codec for PalmOS 3.5. genericpath - Path operations common to more than one OS hotshot - High-perfomance logging profiler, mostly written in C. idlelib.macosxSupport - A number of functions that enhance IDLE on Mac OSX. lib2to3.fixer_util - Utility functions, node construction macros, etc. lib2to3.fixes.fix_getcwdu - Fixer that changes os.getcwdu() to os.getcwd().
参数 -g将启动图形界面
> python -m pydoc -g
参数 -w将指定模块的文本字符串生成HTML格式
> python -m pydoc -w input
wrote input.html