"str"(expr)"str" interpolation syntax
Richie Hindle
richie at entrian.com
Fri Sep 13 04:02:11 EDT 2002
> Maybe something very simple along the lines of:
>
> subst("A template string - here: % it goes\n", foo,
> "Also multiple values: %, %\n", bar, quux,
> "Quoting percent (%) sings probably not needed...\n", '%')
>
> could be useful... Yes it smells like perl formats but the
> intelacing of pictures/values is really near optimal IMHO.
Guido's time machine strikes again:
>>> foo, bar, quux = 1, 2, '3'
>>> print ("A template string - here: %s it goes\n" % foo +
... "Also multiple values: %s, %s\n" % ( bar, quux ) +
... "Quoting percent (%s) sings probably not needed...\n" % '%')
A template string - here: 1 it goes
Also multiple values: 2, 3
Quoting percent (%) sings probably not needed...
--
Richie Hindle
richie at entrian.com
More information about the Python-list
mailing list