[EMAIL PROTECTED] wrote:
> Hi,
>
> I want to append one (huge) file to another (huge) file. The current
> way I'm doing it is to do something like:
>
> infile = open (infilename, 'r')
> filestr = infile.read()
> outfile = open(outfilename, 'a')
> outfile.write(filestr)
>
> I wonder if there is
On Tue, 12 Jul 2005 07:38:39 -0700, [EMAIL PROTECTED] wrote:
> Thanks for the nice suggestions!
>
> As a side question, you mentioned opening files in binary mode, in case
> the code needs to run under Windows or cross-platform. What would
> happen otherwise? Is it an issue of big little endian
On 2005-07-12, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> As a side question, you mentioned opening files in binary
> mode, in case the code needs to run under Windows or
> cross-platform. What would happen otherwise? Is it an issue
> of big little endian or some other issue?
The end-of-line
Its been a while since I last coded in Python, so please make sure you test
it before trying it so you don't clobber your existing file. Although it may
not be more effecient than what you are doing now or has been suggested
already, it sure cuts down on the typing.
open(outfilename,'a').write(ope
Dear me, replying to myself twice in one day...
On Wed, 13 Jul 2005 00:39:14 +1000, Steven D'Aprano wrote:
> Then, if you are concerned that the files really are huge, that is, as big
> or bigger than the free memory your computer has, read and write them in
> chunks:
>
> data = infile.read(64)
Thanks for the nice suggestions!
As a side question, you mentioned opening files in binary mode, in case
the code needs to run under Windows or cross-platform. What would
happen otherwise? Is it an issue of big little endian or some other
issue?
--
http://mail.python.org/mailman/listinfo/pytho
On Tue, 12 Jul 2005 06:47:50 -0700, [EMAIL PROTECTED] wrote:
> Hi,
>
> I want to append one (huge) file to another (huge) file.
What do you call huge? What you or I think of as huge is not necessarily
huge to your computer.
> The current
> way I'm doing it is to do something like:
>
> infile =
Am Tue, 12 Jul 2005 06:47:50 -0700 schrieb [EMAIL PROTECTED]:
> Hi,
>
> I want to append one (huge) file to another (huge) file. The current
> way I'm doing it is to do something like:
>
> infile = open (infilename, 'r')
> filestr = infile.read()
> outfile = open(outfilename, 'a')
> outfile.wri
Hi,
I want to append one (huge) file to another (huge) file. The current
way I'm doing it is to do something like:
infile = open (infilename, 'r')
filestr = infile.read()
outfile = open(outfilename, 'a')
outfile.write(filestr)
I wonder if there is a more efficient way doing this?
Thanks.
--
h