I can't quite figure out what's going on with string templates:
t = Template('cannot teach an ${dog.old} ${tricks.new}. ${why} is this ${not} working')
print t.safe_substitute({'dog.old': 'old dog', 'tricks.new': 'new tricks', 'why': 'OH WHY', 'not': '@#%@#% NOT'})
This prints:
cannot teach an ${dog.old} ${tricks.new}. OH WHY is this @#%@#% NOT working
I thought that the braces handled arbitrary strings... what characters are allowed in braces and is there any way I can subclass Template
to do what I want?