Search⌘ K

Running Scripts

Understand how to run Python scripts directly and test modules by using the special __name__ attribute. Learn to execute code conditionally within a script to control program behavior and get started with your first Python program.

We'll cover the following...

Python modules are objects and have several useful attributes. You can use this to easily test your modules as you write them, by including a special block of code that executes when you run the Python file on the command line. Take the last few lines of ...