15.04.2013 Views

Core Python Programming (2nd Edition)

Core Python Programming (2nd Edition)

Core Python Programming (2nd Edition)

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Command-Line Options<br />

When starting <strong>Python</strong> from the command-line, additional options may be provided to the interpreter.<br />

Here are some of the options to choose from:<br />

-d Provide debug output<br />

-O Generate optimized bytecode (resulting in .pyo files)<br />

-S Do not run importsite to look for <strong>Python</strong> paths on startup<br />

-v Verbose output (detailed trace on import statements)<br />

-m mod run (library) module as a script<br />

-Q opt division options (see documentation)<br />

-c cmd Run <strong>Python</strong> script sent in as cmd string<br />

file Run <strong>Python</strong> script from given file (see later)<br />

1.5.2. As a Script from the Command Line<br />

Unix (Linux, MacOS X, Solaris, *BSD, etc.)<br />

From any flavor of Unix, a <strong>Python</strong> script can be executed by invoking the interpreter on your application<br />

from the command line, as in the following:<br />

$ python script.py<br />

<strong>Python</strong> scripts end with a file extension of .py, as indicated above.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!