Printing formatted strings from a dictionary

Josiah Carlson jcarlson at uci.edu
Wed May 19 16:19:53 EDT 2004


[snip good reply from Peter]

The other thing to remember is that there are implicit quotes:
 >>> d = {1:2}
 >>> "%(1)i"%d
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
KeyError: 1
 >>> "%(1)i"%d
'2'

  - Josiah



More information about the Python-list mailing list