View convert_string_template.py
import re | |
def convert_string_template(string): | |
index = -1 | |
def repl(matched): | |
nonlocal index | |
keyword = matched.group(1) | |
if keyword: | |
return "{%s}" % keyword.strip('()') |