Python help for help

Source: Internet
Author: User

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

1.

If you need quick help for a Python function or statement, you can use the built-in help function. Especially when you use a command line with a prompt, it is very useful. For example, run help (str) -- this will display the help of the str class. The str class is used to save various text (strings) used by your program ). The class will be explained in detail in the next chapter of object-oriented programming.

Press q to exit the help.
Similarly, you can obtain information about almost everything in Python. Use help () to learn more about help!

Help ('print ')
You should have noticed that I use quotation marks on "print" so that Python can understand that I want to get help on "print" instead of asking for something to 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 ")

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.