Import JSON data into Python -
Import JSON data into Python -
this question has reply here:
reading json file using python 3 answerstrying find simple way import info json file python. initial thoughts read file line line, might imply additional processing should done in library.
the ideal solution like:
import json_library the_data = json_library.load_from_file('my_file.json')
where 'my_file.json' contains json-formatted variable.
json you.
import json info = json.load(open('my_file.json', 'r'))
content of demo file:
{"hello":"stack overflow"}
demo:
>>> import json >>> print(json.load(open('my_file.json','r'))) {u'hello': u'stack overflow'}
python json file
Comments
Post a Comment