efficient mega-replacements
Kragen Sitaker
kragen at pobox.com
Fri Jan 25 06:35:53 EST 2002
Jonathan Hogg <jonathan at onegoodidea.com> writes:
> In case you hadn't realised it I thought I'd note that using "regexp"
> strings will save a lot of the stramash of backslashes in your code, as
> follows:
>
> val = val.replace("'","''")\
> .replace(r"\",r"\\\\\\\\")\
You didn't actually try this, did you? :)
> The r'' form of string literals doesn't interpret backslashes.
Approximately true.
More information about the Python-list
mailing list