How To Open The Json File Using Python?
ENG_RequestData.json: { 'appKey': '9c9fa7201e90d3d96718bc3f36ce4cfe1781f2e82f4e5792996623b3b474fee2c77699eb5354f2136063e1ff19c378f0f6dd984471a38ca5c393801bffb062d6', 'appId
Solution 1:
Try this code:
import json
#Path you posted
path = os.path.join('C:'+os.sep+'Users'+os.sep+'Desktop'
+os.sep+'OWN'+os.sep+'2016_02_11'
+os.sep+'ENG_RequestData.json')
def get_tts(LNG,filename):
try:
if LNG == 'ENG':
with open(filename) as json_file:
JSON_ENGData = json.load(json_file)
print(JSON_ENGData)
elif LNG == 'DEU':
with open(DEU_RequestDataFile) as json_file:
JSON_DEUData = json.load(json_file)
else:
print("No Other Language")
except:
print("[ERROR] Cannot open the Request data file")
#Execute the function
get_tts('ENG',path)
More information here: https://stackoverflow.com/a/2422864/5915424
Post a Comment for "How To Open The Json File Using Python?"