File processing
Peter Hansen
peter at engcorp.com
Mon Feb 17 17:55:15 EST 2003
Bjorn Pettersen wrote:
>
> > From: fishers [mailto:m.e.l at btclick.com]
> >
> > Hi
> >
> > Can Python be used to do 'high-level' file processing. for example,
> > appending one file to another? And if so, how?
>
> fp = open('file1', 'a')
> fp.write(open('file2', 'rb').read())
> fp.close()
Should use "ab" to open "file1" unless you want to expand \r\n
combinations in file2 to be \r\r\n when they are added to file1...
-Peter
More information about the Python-list
mailing list