EXECUTION FROM A FILE

Most Python scripts will be executed from a file. Python scripts are written just like Perl with a standard editor – we don't need a special environment or application to create the files. Line termination is significant, since Python relies on the line termination to identify the end of a statement, but Python is flexible enough to support Windows, MacOS, or Unix line endings under the corresponding platforms. However, if you want to exchange the script between platforms you must convert the line endings – you cannot use a Windows text script under MacOS for example.

Unlike Perl, Python doesn't distinguish quite so clearly between a “script” and a “module.” All Python source can potentially be used as a module and imported ...

Get Perl To Python Migration 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.