美文网首页
RIME表转为单行单义表

RIME表转为单行单义表

作者: Ubuntu_2017 | 来源:发表于2019-04-26 16:08 被阅读0次

    RIME 码表正文,直转为「单行单义」表。

    # 导入模块
    import os
    import re
    
    # 获取文件名
    file_list = os.listdir(".")
    my_list = list(filter(lambda x: re.match('.*txt', x) != None, file_list)) 
    
    # 文件名赋值
    txt_name = my_list[0]
    
    # 写正文
    new_table = open('wb98.txt',"a", encoding='utf-16')
    rd_dup = open(txt_name,"r", encoding='utf-16')
    while True:
      dup_line = rd_dup.readline().rstrip()
      if dup_line == "":
          break
      cut_line = dup_line.split('\t')
      dup = cut_line[0] + '\t' + cut_line[1]  + '\n'
      new_table.write(dup)
    rd_dup.close()
    new_table.close()
    print("成功。")
    

    相关文章

      网友评论

          本文标题:RIME表转为单行单义表

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