MCPcopy Create free account
hub / github.com/ndleah/python-mini-project / access_data

Function access_data

Dictionary/dictionary.py:14–23  ·  view source on GitHub ↗
(file_path)

Source from the content-addressed store, hash-verified

12
13
14def access_data(file_path):
15 try:
16 with open(file_path, 'r') as file:
17 return json.load(file)
18 except FileNotFoundError:
19 print(f"Error: !!Oops... I guess you missed to keep things in same folder!!")
20 return {}
21 except json.JSONDecodeError:
22 print(f"Error: !!Oops... I think I am old i cant decode this file is it really json file you programi...!!")
23 return {}
24
25
26

Callers 1

dictionary.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected