1. 程式人生 > >1: Command Line Python(Command line Python scripting)

1: Command Line Python(Command line Python scripting)

We looked at the command line Python interpreter in the last mission. The interpreter lets you run Python commands and see their results immediately. It's very useful for quickly testing snippets of code and debugging. But it's not a good way to develop Python programs, because the commands aren't saved anywhere.

In order to develop Python programs, we'll need to make files containing Python code. We'll then be able to use the interpreter to run them from the command line. This way, we can save all our commands, but still see what's happening.

This is a very common way to develop using Python -- use an IDE or text editor to create Python files, then run them from the command line.

In order to make a file that Python can execute on the command line, we'll need to add some lines to a blank file: