[Tutor] Truncate First Line of File

Alex Ezell aezell at gmail.com
Thu Feb 28 04:04:17 CET 2008


Thanks to everyone for the help. My coworker seems to really prefer
doing it via some system call.

She seems to think it's possible quickly with csplit, which I've never
used. I'll be investigating it in the morning, because she's really
good at what she does. :)

/alex

On Wed, Feb 27, 2008 at 6:53 PM, Tiger12506 <keridee at jayco.net> wrote:
> This is bill's method written out in code which is the python you seek,
>  young warrior!
>
>  inname = 'inputfile'
>  outname = 'outfile'
>
>  infile = open(inname,'r')
>  outfile = open(outname,'w')
>  infile.readline()
>  line = infile.readline()
>  while line != "":
>   outfile.write(line)
>  infile.close()
>  outfile.close()
>  os.rename(inname,outname)
>
>
>
>  _______________________________________________
>  Tutor maillist  -  Tutor at python.org
>  http://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list