command-line one-liners a la Perl?

MRAB python at mrabarnett.plus.com
Thu Jun 18 16:05:12 CEST 2009


kj wrote:
> 
> 
> I'm a recovering Perl addict, and I'm jonesin' badly for command-line
> one-liners, like
> 
>   % perl -lne '@f=split "\t";print join "\t", at f[3,1] if $f[2]=~/frobozz/i' in.txt
> 
> How can I get my fix with Python?
> 
python -c "print 'Hello world!'"

Although you need to remember that Python makes much more use of
whitespace, which limits the usefulness of the command line.



More information about the Python-list mailing list