[New-bugs-announce] [issue19824] string.Template: Add PHP-style variable expansion example

anatoly techtonik report at bugs.python.org
Thu Nov 28 18:07:04 CET 2013


New submission from anatoly techtonik:

http://docs.python.org/2/library/string.html#template-strings

This class could be more useful with the following example:

>>> from string import Template
>>> t = Template('$who likes $what')
>>> who = 'tim'
>>> what = 'kung pao'
>>> t.substitute(locals())
'tim likes kung pao'

This will help PHP folks to transition their .php files.

----------
assignee: docs at python
components: Documentation
messages: 204677
nosy: docs at python, techtonik
priority: normal
severity: normal
status: open
title: string.Template: Add PHP-style variable expansion example

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19824>
_______________________________________


More information about the New-bugs-announce mailing list