Creating simple script files
While we can use all of Python from the REPL, this is not a good way to produce a final application. Most of what we do with Python will be done via script files. We'll look at script files in detail in Chapter 12, Scripts, Modules, Packages, Libraries, and Applications. For now, we'll look at a few features.
A script file has to follow a few rules:
- The content must be plain text. While ASCII encoding is preferred by some, Python 3 can easily handle UTF-8 and most OS-specific variations such as Mac OS Roman or Windows CP-1252. A portable encoding like UTF-8 is strongly suggested.
- Python can cope with Mac OS X, Linux newline (
\n
), as well as Windows CR-LF (\r\n
). Only a few Windows tools, such as Notepad, insist on CR-LF ...
Get Python Essentials now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.