Time for action – using the Python help system

Depending on your operating system, you can access the Python shell with special applications, usually a terminal of some sort.

  1. In such a terminal, type the following command to start a Python shell:
    $ python
    
  2. You will get a short message with the Python version and other information and the following prompt:
    >>>
    

    Type the following in the prompt:

    >>> help()
    

    Another message appears and the prompt changes as follows:

    help>
    
  3. If you type, for instance, keywords as the message says, you get a list of keywords. The topics command gives a list of topics. If you type any of the topic names (such as LISTS) in the prompt, you get additional information about the topic. Typing q quits the information screen. Pressing Ctrl + D together returns you to the normal Python prompt:
    >>>
    

    Pressing Ctrl + D together again ends the Python shell session.

What just happened?

We learned about the Python interactive shell and the Python help system.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset