处理GOT-10k
import os
from os import path
path_dir = '/home/scy310/下载/SiamFC'
new_dir = '/home/scy310/下载/stroage'
for f in os.listdir(path_dir):
# 字符串拼接
f1 = f +'_001.txt'
real_url = path.join(path_dir, f,f1)
with open(real_url, 'r') as f2: # 打开文件
data = f2.read()
data = data.replace(" ",",")
new_url = path.join(new_dir,f,f1)
with open(new_url, 'w') as f3:
f3.write(data)
# 打印出来
print(real_url)
处理Trackingnet
import os
from os import path
path_dir = '/home/scy310/下载/Ours/default_000/'
new_dir = '/home/scy310/下载/Ours/result/'
for root, dirs,f in os.walk(path_dir):
# 字符串拼接
for i in range(len(f)):
real_url = path.join(path_dir, f[i])
with open(real_url, 'r') as f2: # 打开文件
data = f2.read()
data = data.replace("\t",",")
new_url = path.join(new_dir,f[i])
with open(new_url, 'w') as f3:
f3.write(data)