help converting some perl code to python

eight02645999 at yahoo.com eight02645999 at yahoo.com
Fri Nov 4 10:01:50 CET 2005


hi
i need help with converting a piece of perl code to python
.....
my $start = '\[start\]';
my $file = '\[files\]';
my $end = '\[end\]';
....

while(<FILE>) #open a file
{
        if ( /$start/ .. /$file/ ) { # if line match [start] till
[files]
                do something with $_
        }
        if (/$file/ .. /$end/  )
        {
           do something with $_
        }
}

The file looks something like:

[start]
...
[files]
...
[end]

the problem is the '..' operator in perl. Is there any equivalent in
python?
any suggestions ?
thanks




More information about the Python-list mailing list