Easy "here documents" ??

Doug Holton insert at spam.here
Mon Dec 20 23:28:22 EST 2004


Bengt Richter wrote:
>>variable1 = 1
>>variable2 = 2
>>
>>s = """
>>   v = ${variable1}
>>   v2's value is: ${variable2}
>>"""
>>
>>However, Python 3.0 is likely years away.  If you want to know how to 
>>run code like this today, consult Fredrik Lundh.
> 
> 
> Or replace ${...} with equally simple %(...)s in the above and be happy ;-)

I'm afraid you are incorrect.  Simply replacing the $ with % in my 
example will not work in Python.
If you would like to use % instead of $, I recommend requesting that 
feature for Python 3.0: http://www.python.org/cgi-bin/moinmoin/Python3.0



More information about the Python-list mailing list