Appendix B. Running Programs
If you have a program open in IDLE’s file editor, running it is a simple matter of pressing F5 or selecting the Run▸Run Module menu item. This is an easy way to run programs while writing them, but opening IDLE to run your finished programs can be a burden. There are more convenient ways to execute Python scripts.
Shebang Line
The first line of all your Python programs should be a shebang line, which tells your computer that you want Python to execute this program. The shebang line begins with #!
, but the rest depends on your operating system.
On Windows, the shebang line is
#! python3
.On OS X, the shebang line is
#! /usr/bin/env python3
.On Linux, the shebang line is
#! /usr/bin/python3
.
You will be able to run Python ...
Get Automate the Boring Stuff with Python 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.