1. 在终端内输入pydoc+模块名,也就是我们import的那些
smallcaffdeiMac:~ smallcaff$ pydoc time
#######################################
Help on module time:
NAME
time - This module provides various functions to manipulate time values.
FILE
/Users/smallcaff/anaconda2/lib/python2.7/lib-dynload/time.so
MODULE DOCS
https://docs.python.org/library/time
DESCRIPTION
There are two standard representations of time. One is the number
of seconds since the Epoch, in UTC (a.k.a. GMT). It may be an integer
or a floating point number (to represent fractions of seconds).
The Epoch is system-defined; on Unix, it is generally January 1st, 1970.
The actual value can be retrieved by calling gmtime(0).
The other representation is a tuple of 9 integers giving local time.
The tuple items are:
year (four digits, e.g. 1998)
month (1-12)
day (1-31)
hours (0-23)
minutes (0-59)
seconds (0-59)
weekday (0-6, Monday is 0)
Julian day (day in the year, 1-366)
DST (Daylight Savings Time) flag (-1, 0 or 1)
If the DST flag is 0, the time is given in the regular time zone;
if it is 1, the time is given in the DST time zone;
if it is -1, mktime() should guess based on the date and time.
Variables:
timezone -- difference in seconds between UTC and local standard time
altzone -- difference in seconds between UTC and local DST time
:
2. 查看对象所有属性(需要在ipython命令行中)
In [11]: a = [1,2,3]
In [12]: dir(a)
Out[12]:
[\'__add__\',
\'__class__\',
\'__contains__\',
\'__delattr__\',
\'__delitem__\',
\'__delslice__\',
\'__doc__\',
\'__eq__\',
\'__format__\',
\'__ge__\',
\'__getattribute__\',
\'__getitem__\',
\'__getslice__\',
\'__gt__\',
\'__hash__\',
\'__iadd__\',
\'__imul__\',
\'__init__\',
\'__iter__\',
\'__le__\',
\'__len__\',
\'__lt__\',
\'__mul__\',
\'__ne__\',
\'__new__\',
\'__reduce__\',
\'__reduce_ex__\',
\'__repr__\',
\'__reversed__\',
\'__rmul__\',
\'__setattr__\',
\'__setitem__\',
\'__setslice__\',
\'__sizeof__\',
\'__str__\',
\'__subclasshook__\',
\'append\',
\'count\',
\'extend\',
\'index\',
\'insert\',
\'pop\',
\'remove\',
\'reverse\',
\'sort\']
3. 查看对象所有属性的详细说明
In [19]: help(a)
####################
Help on list object:
class list(object)
| list() -> new empty list
| list(iterable) -> new list initialized from iterable\'s items
|
| Methods defined here:
|
| __add__(...)
| x.__add__(y) <==> x+y
|
| __contains__(...)
| x.__contains__(y) <==> y in x
|
| __delitem__(...)
| x.__delitem__(y) <==> del x[y]
|
| __delslice__(...)
| x.__delslice__(i, j) <==> del x[i:j]
|
| Use of negative indices is not supported.
|
| __eq__(...)
| x.__eq__(y) <==> x==y
|
| __ge__(...)
| x.__ge__(y) <==> x>=y
|
| __getattribute__(...)
| x.__getattribute__(\'name\') <==> x.name
|
| __getitem__(...)
| x.__getitem__(y) <==> x[y]
|
| __getslice__(...)
| x.__getslice__(i, j) <==> x[i:j]
|
:
4. 查看对象指定的属性
In [13]: help(a.pop)
##############################
Help on built-in function pop:
pop(...)
L.pop([index]) -> item -- remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
(END)