Python help関数の使い方
ナビゲーションに移動
検索に移動
目次
Python help関数の使い方
Python | 言語まとめ Python |
"対象"に調べたいオブジェクトを設定
- >>> help(対象)
ライブラリ等の場合、importしてから使用する
組み込みオブジェクトのHELPを確認する
組み込みオブジェクト名称を取得
- >>> import pprint
- >>> pprint.pprint(dir(__builtins__))
- ['ArithmeticError',
- 'AssertionError',
- 'AttributeError',
- 'BaseException',
- 'DeprecationWarning',
- 'EOFError',
- 'Ellipsis',
- :
- 'str'
- :
- 'zip']
例えば、文字列型のHELPを確認
オブジェクトではない場合、引用符で囲って使用する
- >>> help('print')
- ------------------------------------------------------------------------
- 6.6 The print statement
- print_stmt ::= "print" ([expression[1] ("," expression[2])* [","]
- | ">>" expression[3] [("," expression[4])+ [","])
- Download entire grammar as text.[5]
- print evaluates each expression in turn and writes the resulting object
- to standard output (see below). If an object is not a string, it is
- :
© 2006 矢木浩人