|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 Saint_HUFS 于 2020-4-30 14:15 编辑
import re
import sys
import codecs
from imp import reload
def myfun(input_file):
p1 = re.compile(r"-\{.*?(zh-hans|zh-cn):([^;]*?)(;.*?)?\}-")
p2 = re.compile(r'[(\(][,;。?!\s]*[)\)]')
p3 = re.compile(r'[「『]')
p4 = re.compile(r'[」』]')
outfile = codecs.open('std_' + input_file, 'w', 'utf-8')
with codecs.open(input_file, 'r', 'utf-8') as myfile:
for line in myfile:
line = p1.sub(r'\2', line)
line = p2.sub(r'', line)
line = p3.sub(r'“', line)
line = p4.sub(r'”', line)
outfile.write(line)
outfile.close()
请问一下这里的‘\2’是什么意思啊,是指(zh-hans|zh-cn)吗?
谢谢 |
|