[Tutor] Perl => Python

Bob H bokchoy@adelphia.net
Tue Jan 21 17:24:07 2003


I have this script in Perl that I had help with and I would like to see the
Python equivelant:

# pragmas
use strict;
use warnings;
 
# modules
use Net::FTP;
use File::Copy;
 
# my variables
my @list;
my @match;
 
my $dir='/public/english_us_canada/antivirus_definitions/norton_antivirus';
my $ftp = Net::FTP->new('ftp.symantec.com', Debug => 0) or die 'Could not
connect: $@\n'; 
$ftp->login('anonymous','iam@updatingnav.com');
$ftp->cwd($dir);
 
@list=$ftp->ls();
 
# this matches the name only by looking at files
# that start with 8 numbers (i.e. 20021203)
foreach(@list) {
    if(m/\d{8}.*x86.exe/) {
        push(@match,$_)
    } 
}
 
if(scalar(@match)) {
    my $file=$match[$#match];
    $ftp->binary();
    $ftp->get($file);
}
 
$ftp->quit;

exit(0);

Thanks in advance...! 

Bob
-----
There are only 10 types
of people in the world:
Those who understand binary
and those who don't.