Running Python

Python programs are executed by an interpreter. On UNIX machines, the interpreter is started by typing python. On Windows and the Macintosh, the interpreter is launched as an application (either from the Start menu or by double-clicking the interpreter’s icon). When the interpreter starts, a prompt appears at which you can start typing programs into a simple read-evaluation loop. For example, in the following output, the interpreter displays its copyright message and presents the user with the >>> prompt, at which the user types the familiar “Hello World” command:

 Python 2.1 (#1, Apr 20 2001, 14:34:45) [GCC 2.95.2 19991024 (release)] on sunos5 Type "copyright", "credits" or "license" for more information. >>> print "Hello World" ...

Get Python Essential Reference, Second Edition 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.