Skip to content

Instantly share code, notes, and snippets.

@jingyuexing
Last active November 11, 2019 21:20
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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