Text files read multiple files into single file, and then recreate the multiple files

Irmen de Jong irmen.NOSPAM at xs4all.nl
Sat Feb 12 18:29:12 EST 2005


googlinggoogler at hotmail.com wrote:
> Hiya,
> 
> The title says it all really, but im a newbie to python sort of. I can
> read in files and write files no probs.
> 
> But what I want to do is read in a couple of files and output them to
> one single file, but then be able to take this one single file and
> recreate the files I put into it.

A ZIP archive perhaps?
See the zipfile module.


> Im really at a loss as to how I go about recovering the files?
> obviously if i scan for a string that specifys the start and end of
> each file, theres the chance that the file might contain this term to
> which would split the files into unwanted chucks of file, which wouldnt
> be wanted.

ZIP archives are binary compressed files. Is this okay or do
you require the file to be a text file?

--Irmen



More information about the Python-list mailing list