Substitution with Hash Values

Jon Ribbens jon+usenet at unequivocal.co.uk
Fri Apr 19 22:41:53 EDT 2002


In article <mailman.1019254077.7316.python-list at python.org>, holger krekel wrote:
> 	 re.sub('\{\{(.*?)\}\}',lambda x: dict[x.group(1)], str)

Need a raw string there, i.e.

  r"\{\{(.*?)\}\}"

Plus 'str' is perhaps not the best choice of variable name ;-)



More information about the Python-list mailing list