If you need quick information about any function or statement in Python, then use the help functionality. This is especially useful when using the interpreter prompt. For example,
>>> help(str)
This displays the help for the str class which represents all strings that you use in your program. Try this now. Classes will be explained in detail in the chapter on object-oriented programming.
Press q to exit the help.
Similarly, you can obtain information about almost anything in Python. Use help() to learn more about using help itself! However, to get help for operators like print, you need the PYTHONDOCS environment variable set. This can be done easily on Linux/Unix using the env command.
$ env \ > PYTHONDOCS=/usr/share/doc/python-docs-2.2.3/html/ \ > python Python 2.2.3 (#1, Oct 15 2003, 23:33:35) [GCC 3.3.1 20030930 (Red Hat Linux 3.3.1-6)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> help('print')
You will notice that I have used quotes to specify print as a string - this is so that Python can understand that it does not have to print something, but it should fetch help about the print statement. The location that I have used above is the one for the Python standard installation which comes with Fedora Core 1 Linux, it might be different for different installations of Python.