本人CSDN博客专栏:https://blog.csdn.net/yty_7
Github地址:https://github.com/yot777/
Python的正则表达式在使用之前都必须加上
import re
sub函数
sub(pattern, repl, string, count=0, flags=0)
pattern:需要替换的原内容或正则表达式。
repl:需要替换成的新内容。
string:待替换的原字符串。
本人CSDN博客专栏:https://blog.csdn.net/yty_7
Github地址:https://github.com/yot777/
Python的正则表达式在使用之前都必须加上
import re
sub(pattern, repl, string, count=0, flags=0)
pattern:需要替换的原内容或正则表达式。
repl:需要替换成的新内容。
string:待替换的原字符串。