Long Live Python!

Rufus V. Smith nospam at nospam
Thu Jul 12 17:05:59 CEST 2001


"Alex Martelli" <aleaxit at yahoo.com> wrote in message
news:9ijpfk02a67 at enews4.newsguy.com...
> My proposed solution relied on the fileinput module's "in-place"
> behavior (WITH a backup, but that's optional I guess:-).  That
> module nicely wraps whatever concerns may need to be wrapped, AND
> works on as many files as you desire.
>
> def allbutfirst(files):
>     for line in fileinput.input(files,inplace=1,backup='.bak'):
>         if fileinput.filelineno()>1: print line,
>

I'm a definite Newbie, but to me this looks like it outputs the result
to stdout, rather than creating a new file with the first line removed,
which is what I thought the goal was.






More information about the Python-list mailing list