User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Python section within the Software Development category of DaniWeb, a massive community of 456,611 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,441 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Python advertiser: Programming Forums
Views: 1493 | Replies: 4
Reply
Join Date: Oct 2006
Posts: 1,669
Reputation: sneekula is on a distinguished road 
Rep Power: 6
Solved Threads: 47
sneekula's Avatar
sneekula sneekula is offline Offline
Posting Virtuoso

File Compression

  #1  
Jan 18th, 2007
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?
No one died when Clinton lied.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2004
Posts: 2,529
Reputation: vegaseat will become famous soon enough vegaseat will become famous soon enough 
Rep Power: 11
Solved Threads: 178
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite

Re: File Compression

  #2  
Jan 18th, 2007
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
May 'the Google' be with you!
Reply With Quote  
Join Date: Oct 2006
Posts: 1,669
Reputation: sneekula is on a distinguished road 
Rep Power: 6
Solved Threads: 47
sneekula's Avatar
sneekula sneekula is offline Offline
Posting Virtuoso

Re: File Compression

  #3  
Jan 21st, 2007
Originally Posted by vegaseat View Post
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?
No one died when Clinton lied.
Reply With Quote  
Join Date: Oct 2006
Posts: 1,669
Reputation: sneekula is on a distinguished road 
Rep Power: 6
Solved Threads: 47
sneekula's Avatar
sneekula sneekula is offline Offline
Posting Virtuoso

Re: File Compression

  #4  
Jan 21st, 2007
Another question, can zipfile archive several files like tarfile? How would you save the decompresed files?
No one died when Clinton lied.
Reply With Quote  
Join Date: Oct 2004
Posts: 2,529
Reputation: vegaseat will become famous soon enough vegaseat will become famous soon enough 
Rep Power: 11
Solved Threads: 178
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite

Re: File Compression

  #5  
Jan 21st, 2007
Originally Posted by sneekula View Post
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
May 'the Google' be with you!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Python Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Python Forum

All times are GMT -4. The time now is 7:17 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC