Amer Neely <[EMAIL PROTECTED]> writes:

> print <<EndHTML;
> <html>
> <body>
> Hello
> </body>
> </html>
> EndHTML

The equivalent in Python would be::

    print """
    <html>
    <body>
    Hello
    </body>
    </html>
    """

You can even use Python's standard textwrap module to indent your code
properly::

    import textwrap

    def foo(bar):
        if baz:
            print textwrap.dedent("""
                <html>
                <body>
                    Hello
                </body>
                </html>
                """)

The 'textwrap.dedent' function strips *common* leading whitespace from
all lines in the string, so in the above example the resulting string
will be as though the original string were typed flush to the left
margin.

See 'help(textwrap.dedent)' for what that function does, or read it
online <URL:http://docs.python.org/lib/module-textwrap>.

-- 
 \            "Madness is rare in individuals, but in groups, parties, |
  `\         nations and ages it is the rule."  -- Friedrich Nietzsche |
_o__)                                                                  |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to