Import JSON data into Python -



Import JSON data into Python -

this question has reply here:

reading json file using python 3 answers

trying 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

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -