you can supply the value-name pairs in a dictionary : Template : String PYTHON TUTORIALS


PYTHON TUTORIALS » String » Template »

 

you can supply the value-name pairs in a dictionary


from string import Template


s = Template('A $thing must never $action.')
d = {
  'thing': 'gentleman',
  'action': 'show his socks'
}
s.substitute(d)

print s



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo String
» Template