[Tutor] Continuation of long lines of string characters

boB Stepp robertvstepp at gmail.com
Wed May 1 04:34:02 CEST 2013


I was just now playing around in the interpreter trying
print('Hello''world!') thinking I would get a syntax error, only to
discover the kernel of what you show below...

On Tue, Apr 30, 2013 at 9:28 PM, brian arb <brianjamesarb at gmail.com> wrote:
> I really like breaking my long strings like...
>
> And rewrite it like this...
> my_very_long_string = ('I have been looking through PEP 8--Style Guide for
> Python Code.'
>                        'It recommends a maximum line length of 79
> characters. What is the'
>                        'preferred way to continue on another line or lines
> really long print'
>                        'functions of string literals (Python 3)? The only
> thing that'
>                        'immediately occurs to me is to break up the string
> literal into'
>                        'multiple parts separated by + and break after the +
> . This seems to'
>                        'use Python\'s built-in line continuation of anything
> between parens. Is'
>                        'this the preferred way to do this?')
>
Thanks!
boB


More information about the Tutor mailing list