Skip to content

Instantly share code, notes, and snippets.

@titaneric
Created November 27, 2017 14:41
Show Gist options
  • Save titaneric/cf2c315e36346ac0258fe9b99e8f41c5 to your computer and use it in GitHub Desktop.
Save titaneric/cf2c315e36346ac0258fe9b99e8f41c5 to your computer and use it in GitHub Desktop.
To vidmle @ptt-python
import json
from urllib.request import urlopen
with urlopen("http://opendata2.epa.gov.tw/AQI.json") as url:
text = url.read().decode("utf8")
json_list = json.loads(text)
with open("AQI.json", "w", encoding="utf8") as f:
json.dump(json_list, f, ensure_ascii=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment