Showing posts with label string. Show all posts
Showing posts with label string. Show all posts

Jan 30, 2012

Python String Templates

import string
template = string.Template("The $speed $color $thing1")
template.substitute(speed='quick', color='brown', thing1='fox')
# 'The quick brown fox'