uncompressed size of .gz file

Cousin Stanley cousinstanley at hotmail.com
Sat Sep 18 12:34:36 EDT 2004


2004-09-16, frankabel at tesla.cujae.edu.cu ....

> Hi!
> What python function give me the uncompressed size of .gz file like
> "gzip -l name_of_compress_file".
> Thank

Frank ....

  You might try calling  gzip -l  
  using the  os.popen  function ....
  
  
import os

path_in = '/path/to/some_file.gz'

pipe_in = os.popen( 'gzip -l %s' % path_in )

list_1  = pipe_in.readlines()

list_2  = list_1[ 1 ].split()

c , u , r , n = list_2

print '\n   ' , c , u , r , n , '\n' 


-- 
Cousin Stanley
Human Being
Phoenix, Arizona



More information about the Python-list mailing list