Python 有一个广泛的内置帮助系统,您可以通过以下方式访问help()
:
>>> 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/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> modules
Please wait a moment while I gather a list of all available modules...
BaseHTTPServer base64 importlib sha
Bastion bdb imputil shelve
CGIHTTPServer binascii inspect shlex
Canvas binhex io shutil
[...]
Enter any module name to get more help. Or, type "modules spam" to search
for modules whose descriptions contain the word "spam".
help> base64
Help on module base64:
NAME
base64 - RFC 3548: Base16, Base32, Base64 Data Encodings
FILE
/usr/local/lib/python2.7/base64.py
MODULE DOCS
http://docs.python.org/library/base64
FUNCTIONS
b16decode(s, casefold=False)
Decode a Base16 encoded string.
s is the string to decode. Optional casefold is a flag specifying whether
a lowercase alphabet is acceptable as input. For security purposes, the
default is False.
The decoded string is returned. A TypeError is raised if s were
incorrectly padded or if there are non-alphabet characters present in the
string.
b16encode(s)
Encode a string using Base16.
s is the string to encode. The encoded string is returned.
b32decode(s, casefold=False, map01=None)
Decode a Base32 encoded string.
s is the string to decode. Optional casefold is a flag specifying whether
a lowercase alphabet is acceptable as input. For security purposes, the
default is False.
RFC 3548 allows for optional mapping of the digit 0 (zero) to the letter O
(oh), and for optional mapping of the digit 1 (one) to either the letter I
(eye) or letter L (el). The optional argument map01 when not None,
specifies which letter the digit 1 should be mapped to (when map01 is not
None, the digit 0 is always mapped to the letter O). For security
purposes the default is None, so that 0 and 1 are not allowed in the
input.
The decoded string is returned. A TypeError is raised if s were
incorrectly padded or if there are non-alphabet characters present in the
string.
b32encode(s)
Encode a string using Base32.
s is the string to encode. The encoded string is returned.