Skip to Content
Perl To Python Migration
book

Perl To Python Migration

by Martin C. Brown
November 2001
Beginner
320 pages
5h 53m
English
Pearson Business
Content preview from Perl To Python Migration

COMMUNICATING WITH THE SYSTEM

The Python sys module provides us with the interface for determining information about the machine and environment in which Python is currently executing. Some of these elements are handled in Perl using built-in variables, others by built-in functions. We'll have a look at all of the compatibility information, and how to make the transition from using one system to another, as well as some of the Python specific elements.

Getting command-line arguments

Within Perl any arguments supplied to the script on the command line are supplied in the standard @ARGV variable. For example, we can accept a list of files to process using:

foreach my $file (@ARGV)
{
    print "Processing $file\n";
...
}

Under Python you must import ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Perl in a Nutshell

Perl in a Nutshell

Nathan Patwardhan, Ellen Siever, Stephen Spainhour
Perl by Example

Perl by Example

Ellie Quigley
Perl Hacks

Perl Hacks

Chromatic, Damian Conway, Curtis Ovid Poe, Curtis (Ovid) Poe

Publisher Resources

ISBN: 0201734885Purchase book