Fortune Telling Collection - Comprehensive fortune-telling - How to match Chinese characters with regular expressions?

How to match Chinese characters with regular expressions?

In general, you can match Chinese in this way, as shown in the figure:&; amplt; img src = "/50/edcbd 2 faf 1a 9 1 6675 CEC 852 BD 886 e 599 _ HD . jpg " data-raw width = " 827 " data-raw height = " 600 " class = " origin _ image zh-light box-thumb " width = " 827 " data-o riginal = "/edcbd 2 faf 1a 9 1675 CEC 852 BDampgt;

First find this soup or regular node, and then match it with the above character group.

Assuming that there is only one node, the usage is as follows:

Import the re-import request as required from bs4 import beautiful soup URL =' XXX' html = req.get (URL). textbs = beautiful soup(html)span = bs . find _ all(' span ',' pro-title ')' ' ' span = re . find all(& lt; span\sclass="pro-title " >【^<; ]+& lt; /span & gt;' ,html)s = span[0]m = re . find all('[\ u4e 00-\ u9fa 5]+',s)' ' ' s = str(span)m = re . find all('[\ u4e 00-\ u9fa 5]+',s)print(m)