Case insensitive version of string.Template?

python at python at
Fri May 15 17:35:09 CEST 2009

Using Python 2.6 or higher: Is there a way to configure
string.Template() to ignore the case of matched identifiers?
In other words, given the following Template string and
dictionary where all keys are lowercase, is there a way to have
my identifiers expanded based on their lowercase values?
import string
values = dict( name='John Doe', phone='999-555-1212' )
output = string.Template( 'My name is $NAME and my phone is
$Phone.' ).safe_substitute( values )
Thank you,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list