re模块的使用
提取,匹配,替换
提取:findall()
匹配:match()
替换 :sub()
例子:
#sub("正则表达式",'替换的字符','需要替换的字符')
html=re.sub('\n','',html)
#findall("正则表达式","要替换的字符")
ret=re.findall(pattern_1,html)
#match("正则表达式","匹配的字符")
re
re模块的使用
提取,匹配,替换
提取:findall()
匹配:match()
替换 :sub()
例子:
#sub("正则表达式",'替换的字符','需要替换的字符')
html=re.sub('\n','',html)
#findall("正则表达式","要替换的字符")
ret=re.findall(pattern_1,html)
#match("正则表达式","匹配的字符")
re