<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
  <head>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1" />
    <title>Case insensitive version of string.Template?</title>
  </head>
  <body dir="ltr">
    Using Python 2.6 or higher: Is there a way to configure string.Template() to ignore the case of matched identifiers?<br /><br />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?<br /><br />import string<br />values = dict( name='John Doe', phone='999-555-1212' )<br />output = string.Template( 'My name is $NAME and my phone is $Phone.' ).safe_substitute( values )<br /><br />Thank you,<br />Malcolm<br />

  </body>
</html>