import os import jsonlines dir = '/home/weifengsun/tangou1/step2/step22/dataset' subdirs = sorted([d for d in os.listdir(dir)]) for subdir in subdirs: json_path = os.path.join(dir, subdir, 'functions.jsonl') if os.path.exists(json_path): with jsonlines.open(json_path) as reader: for obj in reader: if 'score' not in obj: print(subdir) break