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

Python json list as json and write in json file,tkinter popup as messagebox

import uuid
import datetime
import time
import json
import tkinter as tk
import tkinter.messagebox as msgBoxclass Book():def __init__(self,id,name,isbn,comment,content,summary,title,topic):self.id=idself.name=nameself.isbn=isbnself.comment=commentself.content=contentself.summary=summaryself.title=titleself.topic=topicdef __str__(self):return f'Id:{self.id},name:{self.name},isbn:{self.isbn},comment:{self.comment},content:{self.content},summary:{self.summary},title:{self.title},topic:{self.topic}'book_list=[]arr=range(1,100001)
for a in arr:book_list.append(Book(f'{a}',f'Name_{a}',f'ISBN_{a}',f'Comment_{a}',f'Content_{a}',f'Summary_{a}',f'Title_{a}',f'Topic_{a}'))book_data=[]
for bk in book_list:dic={'id':bk.id,'name':bk.name,'isbn':bk.isbn,'comment':bk.comment,'content':bk.content,'summary':bk.summary,'title':bk.title,'topic':bk.topic}book_data.append(dic)jsonFile=f'Json_{datetime.datetime.now().strftime("%Y%m%d%H%M%S%f")}.json'
with open(jsonFile,'a+',encoding='utf-8') as jsonWriteFile:json.dump(book_data,jsonWriteFile,indent=4)msgBox.showinfo(f'json serialization finished!',f'{datetime.datetime.now()} save {len(book_list)} items in {jsonFile}')

 

image

 

 

 

image

 

image

 

http://www.rkmt.cn/news/56809.html

相关文章:

  • windows的句柄和linux的fd对比
  • 【第7章 I/O编程与异常】为什么句柄看起来像指针却不是指针?
  • SQL 基础语法
  • 北大六院后看又相
  • 详细介绍:后端开发常用Linux命令
  • 团队作业 3 - 教学课件和班级管理系统 需求改进 系统设计 - WAR
  • win11下载安装python,命令提示符输入python,打开Microsoft store界面,解决方案
  • 全网都在找的Nano Banana Pro API 来了!便宜稳定0.15/张
  • 通过DataReader获取sql查询的字段元数据信息
  • The 5W2H Problem-Solving Method
  • 重组生长因子全面解析:从结构功能到科研应用指南
  • STM32系统时钟与SysTick定时器
  • 【Linux】教你在 Linux 上搭建 Web 服务器,步骤清晰无门槛 - 详解
  • 【第7章 I/O编程与异常】\r\n 和 \n\r是一回事吗?
  • 2025-11-21
  • Gephi如何支持MySQL数据的复杂查询
  • Fisrt Blog
  • c语言和python如何解决文本文件中“不同平台换行符不兼容”问题
  • 完整教程:政务系统信创改造中,金仓日志如何满足等保2.0三级审计要求
  • 如何使用IDM嗅探视频并下载?
  • java数据结构--LinkedList与链表 - 教程
  • Record-X
  • macos: 景观类动态的壁纸和屏保保存在哪里
  • nju实验二 译码器和编码器
  • 第四十六篇
  • 2025年送礼水果排行榜权威推荐,拉吾尤摩赣南脐橙荣登榜首
  • AI救星!8个写毕业论文的实用AI工具大揭秘
  • 数据血缘图在数据错误追溯中的应用指南
  • CSS基础语法 - 指南
  • 「Temp」目录