「Python help関数の使い方」の版間の差分
ナビゲーションに移動
検索に移動
(ページの作成:「==Python help関数の使い方== [Python][言語まとめ Python] ==="対象"に調べたいオブジェクトを設定=== >>> help(対象) ====ライブラリ…」) |
|||
| (同じ利用者による、間の3版が非表示) | |||
| 1行目: | 1行目: | ||
| − | ==Python help関数の使い方== | + | ==[[Python help関数の使い方]]== |
| − | [Python][言語まとめ Python] | + | [[Python]] | [[言語まとめ Python]] | |
==="対象"に調べたいオブジェクトを設定=== | ==="対象"に調べたいオブジェクトを設定=== | ||
| − | + | >>> help(対象) | |
====ライブラリ等の場合、importしてから使用する==== | ====ライブラリ等の場合、importしてから使用する==== | ||
| − | + | >>> import fileinput | |
| − | + | >>> help(fileinput) | |
| − | Help on module fileinput: | + | [[Help]] on module fileinput: |
NAME | NAME | ||
| − | fileinput - | + | fileinput - [[Help]]er class to quickly write a loop over all standard input fi |
es. | es. | ||
| 20行目: | 20行目: | ||
====組み込みオブジェクトのHELPを確認する==== | ====組み込みオブジェクトのHELPを確認する==== | ||
=====組み込みオブジェクト名称を取得===== | =====組み込みオブジェクト名称を取得===== | ||
| − | + | >>> import pprint | |
| − | + | >>> pprint.pprint(dir(__builtins__)) | |
['ArithmeticError', | ['ArithmeticError', | ||
'AssertionError', | 'AssertionError', | ||
| 35行目: | 35行目: | ||
=====例えば、文字列型のHELPを確認===== | =====例えば、文字列型のHELPを確認===== | ||
| − | + | >>>help(__builtins__.str) | |
| − | Help on class str in module __builtin__: | + | [[Help]] on class str in module __builtin__: |
class str(basestring) | class str(basestring) | ||
| − | | str(object) - | + | | str(object) -> string |
| | | | ||
| − | | | + | | [[R]]eturn a nice string representation of the object. |
| If the argument is a string, the return value is the same object. | | If the argument is a string, the return value is the same object. | ||
| | | | ||
| 47行目: | 47行目: | ||
===オブジェクトではない場合、引用符で囲って使用する=== | ===オブジェクトではない場合、引用符で囲って使用する=== | ||
| − | + | >>> help('print') | |
------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ||
| 53行目: | 53行目: | ||
print_stmt ::= "print" ([expression[1] ("," expression[2])* [","] | print_stmt ::= "print" ([expression[1] ("," expression[2])* [","] | ||
| − | | " | + | | ">>" expression[3] [("," expression[4])+ [","]) |
Download entire grammar as text.[5] | Download entire grammar as text.[5] | ||
2020年2月16日 (日) 04:31時点における最新版
目次
Python help関数の使い方
Python | 言語まとめ Python |
"対象"に調べたいオブジェクトを設定
>>> help(対象)
ライブラリ等の場合、importしてから使用する
>>> import fileinput >>> help(fileinput) Help on module fileinput: NAME fileinput - Helper class to quickly write a loop over all standard input fi es. FILE c:\python25\lib\fileinput.py :
組み込みオブジェクトのHELPを確認する
組み込みオブジェクト名称を取得
>>> import pprint
>>> pprint.pprint(dir(__builtins__))
['ArithmeticError',
'AssertionError',
'AttributeError',
'BaseException',
'DeprecationWarning',
'EOFError',
'Ellipsis',
:
'str'
:
'zip']
例えば、文字列型のHELPを確認
>>>help(__builtins__.str) Help on class str in module __builtin__: class str(basestring) | str(object) -> string | | Return a nice string representation of the object. | If the argument is a string, the return value is the same object. |
オブジェクトではない場合、引用符で囲って使用する
>>> 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 矢木浩人