python help获取帮助

http://woodpecker.org.cn/abyteofpython_cn/chinese/ch03s06.html   

1.

     如果你需要某个Python函数或语句的快速信息帮助,那么你可以使用内建的help功能。尤其在你使用带提示符的命令行的时候,它十分有用。比如,运行help(str)——这会显示str类的帮助。str类用于保存你的程序使用的各种文本(字符串)。类将在后面面向对象编程的章节详细解释。

    按q退出帮助。
     类似地,你可以获取Python中几乎所有东西的信息。使用help()去学习更多关于help本身的东西!

 help('print')
      你应该注意到我特意在“print”上使用了引号,那样Python就可以理解我是希望获取关于“print”的帮助而不是想要它打印东西

http://askubuntu.com/questions/230994/python-2-7-no-documentation-found-when-typing-helpprint

2.

Question:

I have just installed Python 2.7 and Python 3.2 on my Ubuntu 12.04 (32 bit).

However if I open a Python 2.7 shell (python from a terminal) when I type help('print') I get the following message:
no documentation found for 'print'


How can I get to use the documentation in Python 2.7 as well?

Answer:

This looks like a bug of Python 2 as something like help("dir") works properly. It probably does not work because print is a special keyword, unlike Python 3. Stick to Python 3 or run the following command instead of help("print"):
help("__builtin__.print")
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值