O'Reilly logo
  • Eihab Hala thinks this is interesting:

In this case, the three output lines shown in the prior run are stored in the file saveit.txt instead of being printed. This is generally known as stream redirection; it works for input and output text and is available on Windows and Unix-like systems. This is nice for testing, as you can write programs that watch for changes in other programs’ outputs. It also has little to do with Python, though (Python simply supports it), so we will skip further details on shell redirection syntax here.


Cover of Learning Python, 5th Edition


Command-Line Usage Variations. Saveit.txt