>>> import zipfile
>>>
>>> z = zipfile.ZipFile( "./sample.zip", "w", zipfile.ZIP_DEFLATED )
>>> dir(z)
['NameToInfo', '_GetContents', '_RealGetContents', '__del__', '__doc__', '__enter__', '__exit__', '__init__',
'__module__', '_allowZip64', '_didModify', '_extract_member', '_filePassed', '_writecheck', 'close',
'comment', 'compression', 'debug', 'extract', 'extractall', 'filelist', 'filename', 'fp', 'getinfo', 'infolist',
'mode', 'namelist', 'open', 'printdir', 'pwd', 'read', 'setpassword', 'start_dir', 'testzip', 'write', 'writestr']
>>> z.write("./sample.txt")
>>> z.close()
>>>
>>> z = zipfile.ZipFile( "./sample.zip", "r" )
>>> print z.namelist()
['sample.txt']
>>>
>>>
>>> z.read("sample.txt")
'abcdef\n'
z.close()