chatlawv1 / sample /instruct /testjsonl.py
teachyourselfcoding's picture
Upload 245 files
fa6856c
raw
history blame
370 Bytes
import json
with open('/mnt/workspace/caixinyu/vicuna/Chinese-Vicuna/sample/instruct/legislation62k.jsonl', 'r') as file:
for line in file:
try:
json_obj = json.loads(line)
# 如果解析成功,json_obj 将包含每一行的 JSON 数据
except json.JSONDecodeError as e:
print(f"Error in line: {line.strip()}")