How to Access a Specific Value in a JSON File with Python
You can use the json module in Python to load the JSON file and access the value of 'site2' as follows:
import json
# load the JSON file
with open('file.json') as f:
data = json.load(f)
# access the value of 'site2'
site2 = data['sites']['site2']
print(site2) # output: 'm.runoob.com'
原文地址: https://www.cveoy.top/t/topic/osmQ 著作权归作者所有。请勿转载和采集!