博客
关于我
python读取含中文的json
阅读量:797 次
发布时间:2023-03-06

本文共 373 字,大约阅读时间需要 1 分钟。

Python读取中文JSON文件并处理裂纹数据

import json
file_path = r"C:\Users\29939\Desktop\裂纹\Seg\裂纹1.json"
with open(file_path, encoding='utf-8-sig', errors='ignore') as file:
test = json.load(file)
print("已成功读取JSON文件:", test)
# 修改imagePath值为0
test['imagePath'] = 0
print("修改后的JSON数据:", test)
with open("outjson.json", 'w') as f:
json.dump(test, f, indent=2)

转载地址:http://byofk.baihongyu.com/

你可能感兴趣的文章
python locust 性能测试:locust安装和一些参数介绍
查看>>
python log
查看>>
python logging basicconfig_python之logging.basicConfig
查看>>
python mac地址_python中MAC地址打包问题
查看>>
python manage.py syncdb Unknown command: 'syncdb'问题解决方法
查看>>
Python map() 函数 和 numpy mean()函数
查看>>
Python Matplotlib Box并排绘制两个数据集
查看>>
Python matplotlib 中更换画布背景颜色
查看>>
python matplotlib简单使用
查看>>
Python mock Patch os.environ 和返回值
查看>>
Python mock 修补另一个函数调用的函数
查看>>
python mqtt 客户端实现
查看>>
Python Multiprocessing - 将类方法应用于对象列表
查看>>
Python multiprocessing.Queue 与 multiprocessing.manager().Queue()
查看>>
python mysql 基于 sqlalvhrmy_Python操作MySQL:pymysql和SQLAlchemy
查看>>
Python NLP完整项目实战教程(1)
查看>>
Python NLP自然语言处理详解
查看>>
python nltk nltk_data 离线安装,chatterbot
查看>>
python note 06 编码方式
查看>>
python numba 转灰度图_使用NumPy、Numba的简单使用(二)
查看>>