from xpinyin import Pinyin
import os
import unicodedata ,sys
p = Pinyin()
path = "/home/t-huch/car_sketch_cycleGAN/datasets/car_sketch/trainA"
path_lists = os.listdir(path)
for name in path_lists:
new_name = name.encode('ascii','ignore').decode('ascii')
new_name = os.path.join(path, p.get_pinyin(new_name,""))
print(new_name)
os.rename(os.path.join(path, name),new_name)
网友评论