当前位置: 首页 > article >正文

JSONL 文件的检查和修订器

下面是一个JSONL 文件的检查和修订器,代码如下:

import json
import tkinter as tk
from tkinter import filedialog, messagebox

def check_jsonl_file(input_file, log_file, output_file=None):
    errors = []
    valid_lines = []

    with open(input_file, 'r', encoding='utf-8') as infile, open(log_file, 'w', encoding='utf-8') as logfile:
        for line_number, line in enumerate(infile, start=1):
            try:
                data = json.loads(line)
                if not (
                    "question" in data and
                    "xihe_answers" in data and
                    "ling_answers" in data and
                    isinstance(data["question"], str) and
                    isinstance(data["xihe_answers"], list) and
           

http://www.kler.cn/news/342060.html

相关文章:

  • openEuler 24.03 (LTS) 部署 K8s(v1.31.1) 高可用集群(Kubespray Ansible 方式)
  • 手把手教你 vim 多行操作
  • ## jupyter_server
  • mysql对某个数据库的所有表做精准的行数查询,做主从数据库比对
  • 请求响应-08.响应-案例
  • 基于SpringBoot+Vue的网约车管理系统
  • JAVA 多线程入门例子:CountDownLatch
  • 宠物空气净化器哪个牌子吸毛好?希喂、IAM、352真实测评
  • python 实现FP GraphMiner算法
  • Word页眉内容自动填充为章节标题
  • 【redis学习篇1】redis基本常用命令
  • Django学习笔记九:RESTAPI添加用户认证和授权
  • 在thinkphp中发送http请求
  • 5个免费ppt模板网站推荐!轻松搞定职场ppt制作!
  • 【C++】多肽
  • 网关在不同行业自动化生产线的应用
  • 【Vue】vue-admin-template项目搭建
  • 计算机网络803-(4)网络层
  • 古典舞在线交流平台:SpringBoot设计与实现详解
  • 使用 Pktgen 工具进行 PPS 性能测试