如何运用PYTHON正则表达式的句号和星号
1、打开JUPYTER NOTEBOOK,新建一个空白的PY文档。

3、a = re.compile(r'.t')a.findall('at the front of this product.')这里用句号.来表示查找任何字符,但是只含一个字符。

5、b = re.compile(r'.\.')b.findall('you are the winner.')如果要寻找真正的句号,而不是任意字符,可以用\来跳过功能。

7、d = re.compile(r'.*')d.findall('you are good man.')如果不加括号来分组,就会出现错乱。因为用了FINDALL。

9、f = re.compile(r'.*')f.search('You are the man.\nWe are the man.').group()f = re.compile(r'.*', re.DOTALL)f.search('You are the man.\nWe are the man.').group()因为换行的时候不会继续选取,所以用re.DOTALL就可以继续选取。
