How to run a python fileΒΆ

A file with python code in it is a ‘module’ or ‘script’

(more on the distinction later on...)

It should be named with the .py extension: some_name.py

To run it, you have a couple options:

  1. call python on the command line, and pass in your module name
$ python the_name_of_the_script.py
  1. run iPython, and run it from within iPython with the run command
In [1]: run the_file.py