Variables escaping quotes
Erik Max Francis
max at alcyone.com
Mon Aug 19 20:22:13 EDT 2002
Blistex wrote:
> Is there a way for a variable to escape quotation marks? For example:
>
> x=10
> print "The husband only had $x minutes to live before his wife, in a
> rage
> of fury and wrath, would descend upon him like a thousand, shrieking
> banshees, to rend his life (not to mention his manhood) from his
> cowering
> body."
>
> where $x represents the number 10, not literally $x.
Something close:
x = 10
print "The husband had only %(x)d minutes to live." % locals()
--
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/ \ There is nothing so subject to the inconstancy of fortune as war.
\__/ Miguel de Cervantes
Church / http://www.alcyone.com/pyos/church/
A lambda calculus explorer in Python.
More information about the Python-list
mailing list