Python+ Calibre 处理 中文报纸

import re
##2
line='<a href=nw.D110000renmrb_20180401_1-01.htm><script>document.write(view("领航新时代中国经济航船  "))</script></a>'
#line = line.decode("utf-8")
filtrate = re.compile(u'[^\u4E00-\u9FA5]')#非中文
filtered_str = filtrate.sub(r'', line)#replace
print (filtered_str)

##1
tempLine = '<script>document.write(view("加强党中央对经济工作的集中统一领导<br>打好决胜全面建成小康社会三大攻坚战  "))</script>'
filtrate = re.compile(u'[^\u4E00-\u9FA5]')#非中文
filtered_str = filtrate.sub(r'', tempLine)#replace
print (filtered_str)

filtrate = re.findall (r"[\u4e00-\u9fa5]+", tempLine)

print (filtrate)

python 提取 中文

posted @ 2018-04-05 12:07  xiulug  阅读(408)  评论(0编辑  收藏  举报