--登录python
[root@bakdbserver ~]# python
Python 2.7.5 (default, Aug 7 2013, 21:50:17)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-54)] 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> modules
Please wait a moment while I gather a list of all available modules...
BaseHTTPServer array imghdr sha
Bastion ast imp shelve
CDROM asynchat importlib shlex
CGIHTTPServer asyncore imputil shutil
Canvas atexit inspect signal
ConfigParser audiodev io site
Cookie audioop itertools smtpd
DLFCN base64 json smtplib
Dialog bdb keyword sndhdr
DocXMLRPCServer binascii lib2to3 socket
FileDialog binhex linecache spwd
FixTk bisect linuxaudiodev sqlite3
HTMLParser bsddb locale sre
IN cPickle logging sre_compile
MimeWriter cProfile macpath sre_constants
Queue cStringIO macurl2path sre_parse
ScrolledText calendar mailbox ssl
SimpleDialog cgi mailcap stat
SimpleHTTPServer cgitb markupbase statvfs
SimpleXMLRPCServer chunk marshal string
SocketServer cmath math stringold
StringIO cmd md5 stringprep
TYPES code mhlib strop
Tix codecs mimetools struct
Tkconstants codeop mimetypes subprocess
Tkdnd collections mimify sunau
Tkinter colorsys mmap sunaudio
UserDict commands modulefinder symbol
UserList compileall multifile symtable
UserString compiler multiprocessing sys
_LWPCookieJar contextlib mutex sysconfig
_MozillaCookieJar cookielib netrc syslog
__builtin__ copy new tabnanny
__future__ copy_reg nis tarfile
_abcoll crypt nntplib telnetlib
_ast csv ntpath tempfile
_bisect ctypes nturl2path termios
_codecs curses numbers test
_codecs_cn datetime opcode textwrap
_codecs_hk dbhash operator this
_codecs_iso2022 decimal optparse thread
_codecs_jp difflib os threading
_codecs_kr dircache os2emxpath time
_codecs_tw dis ossaudiodev timeit
_collections distutils parser tkColorChooser
_csv doctest pdb tkCommonDialog
_ctypes dumbdbm pickle tkFileDialog
_ctypes_test dummy_thread pickletools tkFont
_elementtree dummy_threading pipes tkMessageBox
_functools email pkgutil tkSimpleDialog
_heapq encodings platform toaiff
_hotshot errno plistlib token
_io exceptions popen2 tokenize
_json fcntl poplib trace
_locale filecmp posix traceback
_lsprof fileinput posixfile ttk
_md5 fnmatch posixpath tty
_multibytecodec formatter pprint turtle
_multiprocessing fpformat profile types
_osx_support fractions pstats unicodedata
_pyio ftplib pty unittest
_random functools pwd urllib
_sha future_builtins py_compile urllib2
_sha256 gc pyclbr urlparse
_sha512 genericpath pydoc user
_socket getopt pydoc_data uu
_sre getpass pyexpat uuid
_strptime gettext quopri warnings
_struct glob random wave
_symtable grp re weakref
_sysconfigdata gzip repr webbrowser
_testcapi hashlib resource whichdb
_threading_local heapq rexec wsgiref
_warnings hmac rfc822 xdrlib
_weakref hotshot rlcompleter xml
_weakrefset htmlentitydefs robotparser xmllib
abc htmllib runpy xmlrpclib
aifc httplib sched xxsubtype
antigravity idlelib select zipfile
anydbm ihooks sets zipimport
argparse imaplib sgmllib
Enter any module name to get more help. Or, type "modules spam" to search
for modules whose descriptions contain the word "spam".
--具体组件的使用
help> modules sets
Here is a list of matching modules. Enter any module name to get more help.
sets - Classes to represent arbitrary sets (including sets of sets).
test.test_sets
help> modules random
Here is a list of matching modules. Enter any module name to get more help.
ctypes.test.test_random_things
random - Random variable generators.
test.test_random
_random
--列出所有关键字
help> keywords
Here is a list of the Python keywords. Enter any keyword to get more help.
and elif if print
as else import raise
assert except in return
break exec is try
class finally lambda while
continue for not with
def from or yield
del global pass
--具体关键字的使用
help> if
The ``if`` statement
********************
The ``if`` statement is used for conditional execution:
if_stmt ::= "if" expression ":" suite
( "elif" expression ":" suite )*
["else" ":" suite]
--列出所有topics
help> topics
Here is a list of available topics. Enter any topic name to get more help.
ASSERTION DEBUGGING LITERALS SEQUENCEMETHODS2
ASSIGNMENT DELETION LOOPING SEQUENCES
ATTRIBUTEMETHODS DICTIONARIES MAPPINGMETHODS SHIFTING
ATTRIBUTES DICTIONARYLITERALS MAPPINGS SLICINGS
AUGMENTEDASSIGNMENT DYNAMICFEATURES METHODS SPECIALATTRIBUTES
BACKQUOTES ELLIPSIS MODULES SPECIALIDENTIFIERS
BASICMETHODS EXCEPTIONS NAMESPACES SPECIALMETHODS
BINARY EXECUTION NONE STRINGMETHODS
BITWISE EXPRESSIONS NUMBERMETHODS STRINGS
BOOLEAN FILES NUMBERS SUBSCRIPTS
CALLABLEMETHODS FLOAT OBJECTS TRACEBACKS
CALLS FORMATTING OPERATORS TRUTHVALUE
CLASSES FRAMEOBJECTS PACKAGES TUPLELITERALS
CODEOBJECTS FRAMES POWER TUPLES
COERCIONS FUNCTIONS PRECEDENCE TYPEOBJECTS
COMPARISON IDENTIFIERS PRINTING TYPES
COMPLEX IMPORTING PRIVATENAMES UNARY
CONDITIONAL INTEGER RETURNING UNICODE
CONTEXTMANAGERS LISTLITERALS SCOPING
CONVERSIONS LISTS SEQUENCEMETHODS1
--具体topics用法
help> FLOAT
Floating point literals
***********************
Floating point literals are described by the following lexical
definitions:
floatnumber ::= pointfloat | exponentfloat
pointfloat ::= [intpart] fraction | intpart "."
exponentfloat ::= (intpart | pointfloat) exponent
intpart ::= digit+
fraction ::= "." digit+
exponent ::= ("e" | "E") ["+" | "-"] digit+
Note that the integer and exponent parts of floating point numbers can
look like octal integers, but are interpreted using radix 10. For
example, ``077e010`` is legal, and denotes the same number as
``77e10``. The allowed range of floating point literals is
implementation-dependent. Some examples of floating point literals:
3.14 10. .001 1e100 3.14e-10 0e0
--离开帮助状态模式
help> quit
You are now leaving help and returning to the Python interpreter.
If you want to ask for help on a particular object directly from the
interpreter, you can type "help(object)". Executing "help('string')"
has the same effect as typing a particular string at the help> prompt.
--查看具体对象帮助
>>> a=1
>>> a
1
>>> help(a)
Help on int object:
class int(object)
| int(x=0) -> int or long
| int(x, base=10) -> int or long
|
| Convert a number or string to an integer, or return 0 if no arguments
| are given. If x is floating point, the conversion truncates towards zero.
| If x is outside the integer range, the function returns a long instead.
|
| If x is not a number or if base is given, then x must be a string or
| Unicode object representing an integer literal in the given base. The
| literal can be preceded by '+' or '-' and be surrounded by whitespace.
| The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to
| interpret the base from the string as an integer literal.
| >>> int('0b100', base=0)
| 4
|
| Methods defined here:
|
| __abs__(...)
| x.__abs__() <==> abs(x)
|
| __add__(...)
| x.__add__(y) <==> x+
.......
| x.__floordiv__(y) <==> x//y
|
| __format__(...)
|
: ##输入q离开帮助
--或是直接使用 help(int)效果是一样的