Perl Range operator paradigm

Laurent Pierron Laurent.Pierron at loria.fr
Tue Oct 16 06:27:26 EDT 2001


Hello Gurus,

In Perl there is a very powerful range operator '..', which, in scalar
context, is acting like line-range (,) operator in sed and awk.

By example, this small program prints all the lines in the file included
between <BODY>...</BODY> :

while (<>) {
   if (/<BODY>/ .. /<\/BODY>/) {print; }
}

How can I do, the same thing in Python ?

Thanks.
--
Laurent PIERRON





More information about the Python-list mailing list