python替換

import re
repl_str='{a:"remove_quotes({{123}})"}'
repl = re.compile(r'\"remove_quotes\((\S+)\)\"')
repl.subn(r'\1', repl_str)

import re
repl_str='{a:"{{123}}}"}'
repl = re.compile(r'\"{{{(\S+)}}}\"')
v,ok=repl.subn(r'{{\1}}', repl_str)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章