L,wang

坚持改革,开放人性的弱点……
Regular Express 匹配中文,所有中文标点符号

import re

import requests

text=requests.get("https://movie.douban.com").text

#1.匹配汉字 \u4E00-\u9FA5 

re.findall('[ \u4E00-\u9FA5]+',text)

#参考

https://www.qqxiuzi.cn/zh/hanzi-unicode-bianma.php

#2.匹配所有中文标点符号  [\u3002|\uff1f|\uff01|\uff0c|\u3001|\uff1b|\uff1a|\u201c|\u201d|\u2018|\u2019|\uff08|\uff09|\u300a|\u300b|\u3008|\u3009|\u3010|\u3011|\u300e|\u300f|\u300c|\u300d|\ufe43|\ufe44|\u3014|\u3015|\u2026|\u2014|\uff5e|\ufe4f|\uffe5]

re.findall('[\u3002|\uff1f|\uff01|\uff0c|\u3001|\uff1b|\uff1a|\u201c|\u201d|\u2018|\u2019|\uff08|\uff09|\u300a|\u300b|\u3008|\u3009|\u3010|\u3011|\u300e|\u300f|\u300c|\u300d|\ufe43|\ufe44|\u3014|\u3015|\u2026|\u2014|\uff5e|\ufe4f|\uffe5]',text)

#参考

https://blog.csdn.net/cysear/article/details/80435756

posted on 2018-12-04 18:23  L,wang  阅读(576)  评论(0编辑  收藏  举报