Skip to content

Instantly share code, notes, and snippets.

@gpiffault
Created May 16, 2014 15:24
Show Gist options
  • Save gpiffault/afbe2352bab7b67cce73 to your computer and use it in GitHub Desktop.
Save gpiffault/afbe2352bab7b67cce73 to your computer and use it in GitHub Desktop.
Reader for zipped csv files (like GTFS)
class GTFSFile(object):
def __init__(self, file_path):
self.archive = zipfile.ZipFile(file_path)
def get_table(self, table_name):
return csv.DictReader(io.TextIOWrapper(self.archive.open(table_name), "utf-8"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment