dealing ascii

作者: 狼无雨雪 | 来源:发表于2019-07-04 18:58 被阅读0次
    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)
    

    相关文章

      网友评论

        本文标题:dealing ascii

        本文链接:https://www.haomeiwen.com/subject/rmxdhctx.html