Easy "here documents" ??

Steve Holden steve at holdenweb.com
Tue Dec 21 08:39:57 EST 2004


Doug Holton wrote:

> 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

Or use boo - it's probably in there already ;-)

must-stop-baiting-the-holton-ly y'rs  - steve
-- 
Steve Holden               http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC      +1 703 861 4237  +1 800 494 3119



More information about the Python-list mailing list