Python vs. Perl, which is better to learn?

Aahz aahz at pythoncraft.com
Thu May 2 10:29:10 EDT 2002


In article <bu7A8.88593$vF6.2633760 at news2.tin.it>,
Alex Martelli  <aleax at aleax.it> wrote:
>
>Actually, I think the "one obvious way to do it" is
>(adding fileinput to the modules you import, and):
>
>for line in fileinput.input():
>        whatever(line)
>
>This gives you stdin if your script is called w/o arguments, or else
>the files with whose names your program is called -- basically like
>Perl's "while(<>)" (one enhancement to fileinput I'd like is a switch
>to have it implicitly call glob.glob on arguments that have wildcards
>when running on Windows, because I do find myself all the time wanting
>to use "python x.py *.foo" indifferently on Windows or Unix-like
>systems -- but that's another issue. I guess).

What I'd like is an argument to specify how many command-line args to
skip over, say if you're writing something like grep.py.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"I used to have a .sig but I found it impossible to please everyone..."  --SFJ



More information about the Python-list mailing list