没搞清这
test = re.sub('abd','adg','abdsss')
test = 'adgsss'
好使
new = '/a.html'
old = '/help/index.jsp?topic=/com.ibm.lotuslive.files.doc/documents_viewer_Files.html'
line = '"text_helpurl" : "/help/index.jsp?topic=/com.ibm.lotuslive.files.doc/documents_viewer_Files.html"'
test = re.sub(old,new, line)
怎么就不好使了,非得用replace...
str.replace(old, new[, count])
探讨使用Python正则表达式进行字符串替换的方法与案例,包括替代与替换的区别及应用场景。

931

被折叠的 条评论
为什么被折叠?



