I have an issue within Jupyter that I cannot find online anywhere and was hoping I could get some help.
Essentially, I want to open .JSON files from multiple folders with different names. For example.
data/weather/date=2022-11-20/data.JSON
data/weather/date=2022-11-21/data.JSON
data/weather/date=2022-11-22/data.JSON
data/weather/date=2022-11-23/data.JSON
I want to be able to output the info inside the data.JSON onto my Jupyter Notebook, but how do I do that as the folder names are all different.
Thank you in advance.
What I tried so far
for path,dirs,files in os.walk('data/weather'): for file in files: if fnmatch.fnmatch(file,'*.json'): data = os.path.join(path,file) print(data)
OUTPUT:
data/weather/date=2022-11-20/data.JSON
data/weather/date=2022-11-21/data.JSON
data/weather/date=2022-11-22/data.JSON
data/weather/date=2022-11-23/data.JSON
But i dont want it to output the directory, I want to actually open the .JSON and display its content