943,767 Members | Top Members by Rank

Ad:
  • Python Discussion Thread
  • Marked Solved
  • Views: 2996
  • Python RSS
Jan 18th, 2007
0

File Compression

Expand Post »
Since there is so much discussion on one of the threads on zipping/unzipping files and all the associated incompatibilities, is there a way to do this with Python and cut out the middleman?
Similar Threads
Reputation Points: 961
Solved Threads: 211
Nearly a Posting Maven
sneekula is offline Offline
2,413 posts
since Oct 2006
Jan 18th, 2007
0

Re: File Compression

Python offers a number of modules providing easy file compression and decompression. Here are code snippets for two of the popular compression formats ...
zipfile -->
http://www.daniweb.com/code/snippet629.html
tarfile -->
http://www.daniweb.com/code/snippet630.html
Moderator
Reputation Points: 1333
Solved Threads: 1403
DaniWeb's Hypocrite
vegaseat is offline Offline
5,792 posts
since Oct 2004
Jan 21st, 2007
0

Re: File Compression

Click to Expand / Collapse  Quote originally posted by vegaseat ...
Python offers a number of modules providing easy file compression and decompression. Here are code snippets for two of the popular compression formats ...
zipfile -->
http://www.daniweb.com/code/snippet629.html
tarfile -->
http://www.daniweb.com/code/snippet630.html
Now that is fairly easy code to work with. I didn't know it was that simple. Does anyone have a particular preference of a compression format?
Reputation Points: 961
Solved Threads: 211
Nearly a Posting Maven
sneekula is offline Offline
2,413 posts
since Oct 2006
Jan 21st, 2007
0

Re: File Compression

Another question, can zipfile archive several files like tarfile? How would you save the decompresed files?
Reputation Points: 961
Solved Threads: 211
Nearly a Posting Maven
sneekula is offline Offline
2,413 posts
since Oct 2006
Jan 21st, 2007
0

Re: File Compression

Click to Expand / Collapse  Quote originally posted by sneekula ...
Another question, can zipfile archive several files like tarfile? How would you save the decompresed files?
An omission on my part, I added another snippet to show you how to pack and unpack files to and from an archived zip file:
http://www.daniweb.com/code/snippet633.html
Moderator
Reputation Points: 1333
Solved Threads: 1403
DaniWeb's Hypocrite
vegaseat is offline Offline
5,792 posts
since Oct 2004

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Python Forum Timeline: Can list comprehension do this?
Next Thread in Python Forum Timeline: Comparing Python and C, Part 10, Structures





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC