Answers for "read a json file from a directory in pythpn"

1

open json file in current directory python

import os
script_dir = os.path.dirname(__file__)
file_path = os.path.join(script_dir, 'relative/path/to/file.json')
with open(file_path, 'r') as fi:
    pass
Posted by: Guest on October-19-2020
-1

python read json file array

import json
arr = json.loads("example.json")
# Do nifty stuff with resulting array.
Posted by: Guest on August-22-2021

Code answers related to "read a json file from a directory in pythpn"

Python Answers by Framework

Browse Popular Code Answers by Language