Skip to content

Instantly share code, notes, and snippets.

@jingyuexing
Last active November 11, 2019 21:20
Show Gist options
  • Save jingyuexing/2bd580cdde8f7b574fb45f69e5a81d9a to your computer and use it in GitHub Desktop.
Save jingyuexing/2bd580cdde8f7b574fb45f69e5a81d9a to your computer and use it in GitHub Desktop.
Read JSON file in Python
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