Mit "r" mit Variablen in re.sub

Ich brauche, um dies zu tun:

text = re.sub(r'\]\n', r']', text)

Aber mit find und replace als Variablen:

find = '\]\n'
replace = ']'
text = re.sub(find, replace, text)

Wo soll ich r (raw)? Es ist kein string.

InformationsquelleAutor Qiao | 2012-11-26
Schreibe einen Kommentar