Python “hello, world!” (in a file)

This tutorial recaps the Python “hello, world!” of the previous the tutorial. The difference is that here you’ll save the code you write to disk.

Writing the file

Change to whatever directory you’d like and then use your text editor to create a new file called

Type the following line of Python code into

print('hello, world!')

Save when you’re done.

Interpreting the file

Open the terminal and call Python on

$ python
hello, world!

Python reads as input and outputs hello, world! to the terminal.

Repeating the process

Working with Python files means doing these things:

1. write a file
2. interpret the file
3. repeat 1 - 2

Experience will make this edit-interpret loop familiar. And no matter how complicated the projects you develop this way of working with Python files will stay the same.