Learn To Program
Increase Your Knowlegde and Build Your Skill!
Pages
(Move to ...)
Home
Me
▼
Monday, March 21, 2011
Python - gzip File
To create a gzip file, type
>>> import gzip
>>> content = 'This is the big text file'
>>> f = gzip.open('hello.gz', 'wb')
>>> f.write(content)
>>> f.close()
To read from a gz file, type
>>> f = gzip.open('hello.gz', 'rb')
>>> content = f.read()
No comments:
Post a Comment
‹
›
Home
View web version
No comments:
Post a Comment