Proper indentation for Python multiline strings

Posted by ensnare on Stack Overflow See other posts from Stack Overflow or by ensnare
Published on 2010-03-23T23:35:28Z Indexed on 2010/03/23 23:43 UTC
Read the original article Hit count: 254

Filed under:
|
|

What is the proper indentation for Python multiline strings within a function?

    def method:
        string = """line one
line two
line three"""

or

    def method:
        string = """line one
        line two
        line three"""

or something else?

It looks kind of weird to have the string hanging outside the function in the first example.

Thanks.

© Stack Overflow or respective owner

Related posts about python

Related posts about beginner