当前位置:网站首页>修改VOT2018.json文件,去掉图片路径中的color
修改VOT2018.json文件,去掉图片路径中的color
2022-08-09 11:32:00 【匿名的魔术师】
直接上代码
import json
import os, sys
json_path = 'VOT2018.json'
new_json_path = 'VOT2018_new.json'
txt_path = 'list.txt'
dict = {}
def get_json_data(path): # 修改 删除原json文件中的color
with open(path) as f:
params = json.load(f)
file = open('list.txt')
while 1 :
lines = file.readline(1000)
if not lines:
break
lines = lines[:-1] # 拿出每个视频文件夹的名字
root = (params[lines]['img_names'])
for i in range(len(root)):
kind, color, jpg = root[i].split('/') # 举例 kind :'ants1', color: 'color' , jpg :'00000001.jpg'
root[i] = kind + '/' + jpg # 重写该路径,去掉 color
file.close()
dict = params
# print(dict)
f.close()
return dict
def write_json_data(path, dictionary): # 保存
with open(path, 'w') as r:
json.dump(dictionary, r)
r.close()
if __name__ =='__main__':
dictionary = get_json_data(json_path)
write_json_data(new_json_path, dictionary)
OK
边栏推荐
- C语言中信号函数(signal)的使用
- x86异常处理与中断机制(3)中断处理过程
- Semaphore SIGCHLD use, how to make the parent that the child performs over, how to make the distinction between multiple child processes. The end
- 湖南进芯电子替代TIC2000的可能性
- PAT1003
- Redis的下载安装
- 二重指针-char **、int **的作用
- The use of C language typedef 】 : structure, basic data types, and array
- PTA 计算天数
- PTA 换硬币
猜你喜欢
随机推荐
Semaphore SIGCHLD use, how to make the parent that the child performs over, how to make the distinction between multiple child processes. The end
_main C:/ti/ccs1011/ccs/tools/compiler/ti-cgt-c2000_20.2.1.LTS/lib/rts2800_fpu32.lib<ar在线升级跳转疑问
Fapi_StatusType Fapi_issueProgrammingCommand使用注意事项
人体解析(Human Parse)开源数据集整理
Visual Studio 2017 ASP.NET Framework MVC 项目 MySQL 配置连接
The use of C language typedef 】 : structure, basic data types, and array
使用gdb调试多进程程序、同时调试父进程和子进程
API接口是什么?API接口常见的安全问题与安全措施有哪些?
ECCV 2022 Oral | CCPL: 一种通用的关联性保留损失函数实现通用风格迁移
Use gdb to debug multi-process programs, debug parent and child processes at the same time
LeetCode_单调栈_中等_456.132 模式
[工程数学]1_特征值与特征向量
学长告诉我,大厂MySQL都是通过SSH连接的
【Data augmentation in NLP】——1
redis的缓存穿透、缓存雪崩、缓存击穿怎么搞?
未来装备探索:数字孪生装备
论文分享 | ACL2022 | 基于迁移学习的论元关系提取
LeetCode 1413.逐步求和得到正数的最小值
ACM最长不下降子序列问题
enum in c language