Skip to content

Instantly share code, notes, and snippets.

@kwmt
Created July 19, 2013 15:57
Show Gist options
  • Save kwmt/6040265 to your computer and use it in GitHub Desktop.
Save kwmt/6040265 to your computer and use it in GitHub Desktop.
How to use zipfile
def channel(nothing):
import zipfile
import re
zip = zipfile.ZipFile('channel.zip')
comments = ''
while True:
s = zip.open(nothing+'.txt', 'r').read()
comments += zip.getinfo(nothing+'.txt').comment
print s
nothing = ''.join(re.findall('(\d+)$', s))
if len(nothing) == 0:
print comments
break
if __name__ == '__main__':
import sys
if len(sys.argv) > 1:
channel(sys.argv[1])
else:
print 'Usage: %s [nothing]' % sys.argv[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment