Raspberry Pi A User Manual page 193

Hide thumbs Also See for Raspberry Pi A:
Table of Contents

Advertisement

C H A P T E R 1 2
Before you run your program, save it as
using IDLE, the file will be given the extension
tor, be sure to type
.py
sion indicates that the file contains Python code—although Python is clever enough to run
the program even if it's saved with a different file extension.
How you run the file will depend on whether you're using IDLE or a text editor. In IDLE,
simply choose Run Module from the Run menu, or press the F5 key on the keyboard. This
will switch IDLE back to the Python shell window and run the program. You should then see
the message
Hello, World!
syntax—in particular, check that you have quotation marks at both the beginning and end of
the message on the
print
If you created the
helloworld.py
window from the Accessories menu on the desktop. If you saved the file anywhere except
your home directory, you'll also have to use the
Chapter 3, "Linux System Administration"). Once you're in the right directory, you can run
your program by typing the following:
python helloworld.py
A N I N T R O D U C T I O N T O P Y T H O N
helloworld.py
.py
at the end of the filename (not
appear onscreen in blue (see Figure 12-3). If not, check your
line.
program in a text editor, you'll need to open a terminal
cd
using the File menu. If you're
automatically. If you're using a text edi-
) when you save it. This exten-
.txt
command to change to that directory (see
177
Figure 12-2:
Syntax
highlighting
in IDLE

Hide quick links:

Advertisement

Table of Contents
loading

Related Products for Raspberry Pi Raspberry Pi A

This manual is also suitable for:

Raspberry pi b

Table of Contents