[Tutor] Reading compressed files

Shadab Sayani shadabsayani at yahoo.com
Wed Feb 21 01:41:26 CET 2007

  I have compressed files compressed using different techniques  (especially unix compress). So I want to have a module that reads any  of these (.Z,.bz,.tgz files) files and manipulates the data.
  The data has a syntax.It contains
  HEADER (some information)
  BODY      (some information)
  FOOTER   (some information)
  If it were a normal text file I can get the values corresponding to HEADER BODY and FOOTER by open function.
  But here the files are in different format .Z , .bz ,.tgz,.gz .But I  know these are the only formats.Also I cannot rely upon the extensions  of the file (a .Z file can have no extension at all).Is there a way to  identify  which file am I reading and then  read it?If so how  to read it?
  Thanks and Regards,
 Send instant messages to your online friends http://uk.messenger.yahoo.com 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070221/6622e934/attachment.htm 

More information about the Tutor mailing list