fp = open('materials/ch_dict.txt', 'r', encoding='utf-8') fp2 = open('materials/chinese_cht_dict.txt', 'r', encoding='utf-8') fp1 = open('materials/tw_idcard_dict.txt', 'a', encoding='utf-8') list = [] for line in fp.readlines(): # print(line.split('\t')[-1].rstrip('\n')) list.extend(line.split('\t')[-1].rstrip('\n')) list2 = [] for line in fp2.readlines(): # print(line.split('\t')[-1].rstrip('\n')) list2.extend(line.split('\t')[-1].rstrip('\n')) list.extend(list2) for word in set(list): fp1.write(word+'\n') # python tools/train.py -c configs/rec/PP-OCRv3/ch_PP-OCRv3_rec.yml # visualdl --logdir output/tw_idcard/vdl --port 8080