Last active
November 11, 2019 21:20
-
-
Save jingyuexing/2bd580cdde8f7b574fb45f69e5a81d9a to your computer and use it in GitHub Desktop.
Read JSON file in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def readJSON(fileName=""): | |
import json | |
if fileName!='': | |
strList = fileName.split(".") | |
if strList[len(strList)-1].lower() == "json": | |
with open(fileName,mode='r',encoding="utf-8") as file: | |
return json.loads(file.read()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment