update,
This commit is contained in:
20
task1/archive/task1_fufill_answer.py
Normal file
20
task1/archive/task1_fufill_answer.py
Normal file
@@ -0,0 +1,20 @@
|
||||
# https://api.data.gov.hk/v1/carpark-info-vacancy?data=vacancy&vehicleTypes=privateCar
|
||||
import requests
|
||||
from pprint import pprint
|
||||
|
||||
url = "https://api.data.gov.hk/v1/carpark-info-vacancy"
|
||||
|
||||
response = requests.get(url)
|
||||
js_result = response.json()['results']
|
||||
|
||||
js_row = js_result[0]
|
||||
|
||||
pprint(js_row)
|
||||
pprint("length of json: "+str(len(js_result)))
|
||||
|
||||
|
||||
import json
|
||||
|
||||
# Store js_result into js_result.json
|
||||
with open('js_result.json', 'w') as outfile:
|
||||
json.dump(js_result, outfile, indent=2)
|
Reference in New Issue
Block a user