Substitution with Hash Values

holger krekel pyth at devel.trillke.net
Sat Apr 20 07:49:06 EDT 2002


On Sat, Apr 20, 2002 at 02:41:53AM -0000, Jon Ribbens wrote:
> 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"\{\{(.*?)\}\}"

yes, i am sometimes confused by 'raw strings' and 'strings'. 
Could you help by saying why exactly it is needed here?

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

right. 

	holger





More information about the Python-list mailing list