python查看模塊况芒、對象用法的命令

1. 在終端內(nèi)輸入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. 查看對象所有屬性的詳細(xì)說明

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)
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末舅巷,一起剝皮案震驚了整個(gè)濱河市面氓,隨后出現(xiàn)的幾起案子兵钮,更是在濱河造成了極大的恐慌,老刑警劉巖舌界,帶你破解...
    沈念sama閱讀 222,865評論 6 518
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件掘譬,死亡現(xiàn)場離奇詭異,居然都是意外死亡呻拌,警方通過查閱死者的電腦和手機(jī)葱轩,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 95,296評論 3 399
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來藐握,“玉大人靴拱,你說我怎么就攤上這事』眨” “怎么了袜炕?”我有些...
    開封第一講書人閱讀 169,631評論 0 364
  • 文/不壞的土叔 我叫張陵,是天一觀的道長初家。 經(jīng)常有香客問我偎窘,道長乌助,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 60,199評論 1 300
  • 正文 為了忘掉前任陌知,我火速辦了婚禮眷茁,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘纵诞。我一直安慰自己上祈,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 69,196評論 6 398
  • 文/花漫 我一把揭開白布浙芙。 她就那樣靜靜地躺著登刺,像睡著了一般。 火紅的嫁衣襯著肌膚如雪嗡呼。 梳的紋絲不亂的頭發(fā)上纸俭,一...
    開封第一講書人閱讀 52,793評論 1 314
  • 那天,我揣著相機(jī)與錄音南窗,去河邊找鬼揍很。 笑死,一個(gè)胖子當(dāng)著我的面吹牛万伤,可吹牛的內(nèi)容都是我干的窒悔。 我是一名探鬼主播,決...
    沈念sama閱讀 41,221評論 3 423
  • 文/蒼蘭香墨 我猛地睜開眼敌买,長吁一口氣:“原來是場噩夢啊……” “哼简珠!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起虹钮,我...
    開封第一講書人閱讀 40,174評論 0 277
  • 序言:老撾萬榮一對情侶失蹤聋庵,失蹤者是張志新(化名)和其女友劉穎,沒想到半個(gè)月后芙粱,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體祭玉,經(jīng)...
    沈念sama閱讀 46,699評論 1 320
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 38,770評論 3 343
  • 正文 我和宋清朗相戀三年春畔,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了脱货。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 40,918評論 1 353
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡拐迁,死狀恐怖蹭劈,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情线召,我是刑警寧澤铺韧,帶...
    沈念sama閱讀 36,573評論 5 351
  • 正文 年R本政府宣布,位于F島的核電站缓淹,受9級特大地震影響哈打,放射性物質(zhì)發(fā)生泄漏塔逃。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 42,255評論 3 336
  • 文/蒙蒙 一料仗、第九天 我趴在偏房一處隱蔽的房頂上張望湾盗。 院中可真熱鬧,春花似錦立轧、人聲如沸格粪。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,749評論 0 25
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽帐萎。三九已至,卻和暖如春胜卤,著一層夾襖步出監(jiān)牢的瞬間疆导,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 33,862評論 1 274
  • 我被黑心中介騙來泰國打工葛躏, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留澈段,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 49,364評論 3 379
  • 正文 我出身青樓舰攒,卻偏偏與公主長得像败富,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個(gè)殘疾皇子芒率,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,926評論 2 361

推薦閱讀更多精彩內(nèi)容