I'm new to Python. I have to open a folder which contains several folders. Then inside each folder of the several folders there is one folder contains the files that i want to read. i need to open the folder then loop through the several folders inside then open the folder in each of them then open the files. i don't really know how to start. can anyone please help me where to start. i'm trying the following but got really stuck path_to_json = r'main folder'
for file_name in os.listdir(path_to_json):
if file_name.endswith(".json"):
print(file_name)
else:
current_path = "".join((path_to_json, "/", file_name))
if os.path.isdir(current_path):
scan_folder(current_path)