Re: [Tutor] Truncate First Line of File

2008-02-28 Thread Alan Gauld
"Alex Ezell" <[EMAIL PROTECTED]> wrote > 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

Re: [Tutor] Truncate First Line of File

2008-02-27 Thread Alex Ezell
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:

Re: [Tutor] Truncate First Line of File

2008-02-27 Thread Tiger12506
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()

Re: [Tutor] Truncate First Line of File

2008-02-27 Thread Alan Gauld
"Alex Ezell" <[EMAIL PROTECTED]> wrote >> > What I need to do is to truncate the first line of a file which >> has an >> > unknown number of lines and an unknown size. > I might do something like this: > os.system("sed -i '1d' %s" % filename) > > I suspect it will be much faster on large file

Re: [Tutor] Truncate First Line of File

2008-02-27 Thread Alex Ezell
On Wed, Feb 27, 2008 at 5:01 PM, Kent Johnson <[EMAIL PROTECTED]> wrote: > > Alex Ezell wrote: > > I must be missing some simple method on a file object or something. > > > > What I need to do is to truncate the first line of a file which has an > > unknown number of lines and an unknown size.

Re: [Tutor] Truncate First Line of File

2008-02-27 Thread Bill Campbell
On Wed, Feb 27, 2008, Alex Ezell wrote: >I must be missing some simple method on a file object or something. > >What I need to do is to truncate the first line of a file which has an >unknown number of lines and an unknown size. > >The only thing I can think to do is to readlines() and then slice o

Re: [Tutor] Truncate First Line of File

2008-02-27 Thread Kent Johnson
Alex Ezell wrote: > I must be missing some simple method on a file object or something. > > What I need to do is to truncate the first line of a file which has an > unknown number of lines and an unknown size. > > The only thing I can think to do is to readlines() and then slice off > the first l

[Tutor] Truncate First Line of File

2008-02-27 Thread Alex Ezell
I must be missing some simple method on a file object or something. What I need to do is to truncate the first line of a file which has an unknown number of lines and an unknown size. The only thing I can think to do is to readlines() and then slice off the first line in the resulting list, then