Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
26 lines (21 sloc) 797 Bytes
import codecs
import csv
import os
import requests
import zipfile
URL = ''
OUTPUT_FILE_PATH = '/src/data/output.csv'
# GET raw data
r = requests.get(URL)
with open('/tmp/', 'wb') as file:
# UNZIP data
with zipfile.ZipFile('/tmp/', 'r') as zip_ref:
# CONVERT data into CSV
with open(OUTPUT_FILE_PATH, 'w', newline='') as output:
spamwriter = csv.writer(output, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
with'/tmp/KEN_ALL.CSV', 'r', 'shiftjis') as input:
spamreader = csv.reader(input, delimiter=',', quotechar='"')
for row in spamreader:
spamwriter.writerow([x.strip() for x in row])