perl "-n" option in python?

Juergen Hoetzel hoetzel at informatik.uni-mannheim.de
Mon May 3 12:38:53 EDT 1999


Hi everyone!

I switched from perl to python some months ago.
One think i liked in perl was the "-n" option to assume a 'while (<>) { ... } loop
around the script. I used this option to do some quick jobs on
the command line. For example:

perl -n -e "/regex/ && print"

So i was never forced to use awk/sed.

Why isn't there something equivalent in python?

Juergen




More information about the Python-list mailing list