Case insensitive version of string.Template?

python at bdurham.com python at bdurham.com
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,
Malcolm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090515/8e012698/attachment.html>


More information about the Python-list mailing list