Oh, I forgot to say something else...

Hanlie Pretorius wrote:

f1 = 'GSMaP_MVK+.20050101.00.0.1deg.hourly.v484.gz'
f2 = ''text.txt.gz'
if1 = gzip.open(f1, 'rb')
if2 = gzip.open(f2,'rb')
try:
   print if1.read()
   print 'done with f1'


Once you've read the file once, the file pointer is at the end of the file, and reading it again returns the empty string. Example:


>>> y = gzip.open('spam.gz', 'rb')
>>> y.read()  # read to the end
'spam spam spam'
>>> y.read()  # anything left?
''
>>> y.seek(0)  # go back to the beginning
>>> y.read()
'spam spam spam'



--
Steven

_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to