Skip to content

Commit

Permalink
Added eightyformat.readzip
Browse files Browse the repository at this point in the history
  • Loading branch information
turian committed Nov 16, 2009
1 parent 3d3a039 commit ac1bbc9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions eightyformat.py
@@ -1,6 +1,8 @@
#!/usr/bin/python

import sys, struct
import zipfile
from cStringIO import StringIO

def read(file):
"""
Expand Down Expand Up @@ -30,9 +32,26 @@ def read(file):
# print data.decode("utf-8")
l = file.read(1*4)

def readzip(zfilename):
"""
Read a zipfile and process all .80 files therein.
"""
zfile = zipfile.ZipFile(zfilename, "r")
for info in zfile.infolist():
fname = info.filename
if fname.endswith(".80"):
data = zfile.read(fname)
for r in read(StringIO(data)):
yield r


if __name__ == "__main__":
i = 0
for url, data in read(sys.stdin):
print url
i += 1
f = open("in3/%d.html" % i, "w")
f.write(data)
# print url, data
# print url, len(data)
# print len(data)

0 comments on commit ac1bbc9

Please sign in to comment.