INTERACTIVELY

The Python interpreter works slightly differently to many other interpreters in that you can enter Python statements directly into the interpreter, rather than having to create a file and then execute. Interactive mode is very useful when you want to quickly try a particular statement or for very short applications – it's possible for example to import a module and check your e-mail from within Python's interactive mode.

To start interactive mode, just load the Python interpreter. Under Unix, you do this by supplying the name of the Python interpreter at the command line:

 $ python Python 2.0 (#4, Dec 16 2000, 07:30:29) [GCC 2.95.2 19991024 (release)] on sunos5 Type "copyright", "credits" or "license" for more information. >>>  ...

Get Perl To Python Migration now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.