0
import json
import requests
from pprint import pprint 
r = requests.get('http://www.geologycloud.tw/data/zh-tw/liquefaction?area=%E5%98%89%E7%BE%A9&classify=%E9%AB%98%E6%BD%9B%E5%8B%A2&all=true')
doc = json.loads(r.text)
pprint(doc['features'][0]['geometry']['coordinates'])
3
  • What's your question exactly ??? Commented Mar 21, 2017 at 15:06
  • What is it that you're asking? The given code outputs something for me. Commented Mar 21, 2017 at 15:07
  • the code runs, I think they are just looking to save it to disk. Commented Mar 21, 2017 at 15:10

1 Answer 1

1

There are several ways to save data to disk. I would try this:

import json
import requests
from pprint import pprint 
import pickle

r = requests.get('http://www.geologycloud.tw/data/zh-tw/liquefaction?area=%E5%98%89%E7%BE%A9&classify=%E9%AB%98%E6%BD%9B%E5%8B%A2&all=true')
doc = json.loads(r.text)
pprint(doc['features'][0]['geometry']['coordinates'])

with open('data.pkl', 'wb') as output:
    pickle.dump(doc['features'][0]['geometry']['coordinates'], output)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.