【发布时间】:2013-01-02 10:13:45
【问题描述】:
所以我是 Python 新手,我正在使用 IDLE。我使用什么命令,所以 Python shell(按 f5 后)向我显示了描述(我在函数名后面的“”“”“”中写的东西) 和/或显示其他功能的描述!?
如果它在 2.7 和 3.3 中有所不同,如果您提及,我将不胜感激。
【问题讨论】:
标签: python python-3.x python-2.7
所以我是 Python 新手,我正在使用 IDLE。我使用什么命令,所以 Python shell(按 f5 后)向我显示了描述(我在函数名后面的“”“”“”中写的东西) 和/或显示其他功能的描述!?
如果它在 2.7 和 3.3 中有所不同,如果您提及,我将不胜感激。
【问题讨论】:
标签: python python-3.x python-2.7
【讨论】:
你使用:
help(your_function_name)
就像我在这里所做的:
>>> def sayhello():
"""This says hello to you"""
print "Hello there!"
>>> help(sayhello)
Help on function sayhello in module __main__:
sayhello()
This says hello to you
编辑: 您必须先导入自己的模块。
【讨论】:
使用 help() 函数
示例:
帮助(打印) 关于内置模块内置函数打印的帮助:
打印(...) print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False)
Prints the values to a stream, or to sys.stdout by default.
Optional keyword arguments:
file: a file-like object (stream); defaults to the current sys.stdout.
sep: string inserted between values, default a space.
end: string appended after the last value, default a newline.
flush: whether to forcibly flush the stream.
【讨论】: