multi-quoted strings for HERE documents

John Hunter jdhunter at ace.bsd.uchicago.edu
Mon Nov 18 19:58:35 EST 2002


>>>>> "Michael" == Michael P Soulier <msoulier at storm.ca._nospam> writes:

    Michael>     But then the block isn't really lined-up the same as
    Michael> the output will look like. It's a minor thing, I know,
    Michael> but it bugs me.

    Michael>     Does anyone have a better way of doing this?


How about

s = """
<table>
    <tr>
        <td>cell contents</td>
    </r>
</table>
"""

print s.lstrip()

Or in python2.3 (untested)
print s.lstrip('\n')

http://www.python.org/dev/doc/devel/whatsnew/node12.html#SECTION0001210000000000000000


John Hunter




More information about the Python-list mailing list