python re 学习


>>> import re >>> re.findall(r'\bf[a-z]*', 'which foot or hand fell fastest')
在python命令行窗口输入以上命令,会出现一个列表['foot','fell','fastest'],
这个结果是根据第一个参数在第二个参数字符串出找出来的单词,他们都是以f开头的单词。
\bf表示以f开头后面是a-z的任意字符。


posted @ 2022-01-21 10:44  paoPaoLong_liu  阅读(50)  评论(0)    收藏  举报