Shadab Sayani wrote: > Hi, > 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, > Shadab. > > Send instant messages to your online friends http://uk. messenger.yahoo.com > The usual way is that used by the "file" utility - take a look at the /etc/magic file to see if you can gain any clues from that.
regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Skype: holdenweb http://del.icio.us/steve.holden Blog of Note: http://holdenweb.blogspot.com See you at PyCon? http://us.pycon.org/TX2007 -- http://mail.python.org/mailman/listinfo/python-list