import json import os import re root_folder = 'RainbowDash_39k' print(os.listdir(root_folder)) def printTheNameOfModelSpk(nameOfModelSpk): print("name of the model is: " + nameOfModelSpk) def seekJsonSpk(jsonFile): ###print('ok 2') if 'spk' in jsonFile: for key, value in data['spk'].items(): ###print('ok 3') #'key' is the model speaker name, needs to be converted to str #print(key) collectSpkString = str(key) printTheNameOfModelSpk(collectSpkString) #this is just 1 or 0 number, ignore it #print(value) for root, dirs, files in os.walk(root_folder): for file in files: if file.endswith('.json'): print(file) json_file = os.path.abspath(os.path.join(root, file)) #print(json_file) with open(json_file) as json_file: data = json.load(json_file) ###print('ok') seekJsonSpk(data) shit = """ for files in os.walk(root_folder): print(files) for file in files: print(file) if not file.endswith('.json'): print("No JSON file in the folder ") else: print(file) """