Skip to content

Instantly share code, notes, and snippets.

View bdowling's full-sized avatar
📈
Onward and Upward!

Brian Dowling bdowling

📈
Onward and Upward!
View GitHub Profile
@haard
haard / battery.py
Last active November 27, 2016 22:48
Batteries included: Download, unzip and parse in 13 lines - http://blaag.haard.se/Batteries-included--Download--unzip-and-parse-in-13-lines/
import zipfile, urllib, csv, os, codecs
def get_items(url):
filename, headers = urllib.urlretrieve(url)
try:
with zipfile.ZipFile(filename) as zf:
csvfiles = [name for name in zf.namelist()
if name.endswith('.csv')]
for item in csvfiles:
with zf.open(item) as source: