有多种方法可以做到这一点。1)。长声明:>>> def print_something(): print 'This is a really long line,', \ 'but we can make it across multiple lines.'2)。使用括号:>>> def print_something(): print ('Wow, this also works?', 'I never knew!')3)。\再次使用:>>> x = 10>>> if x == 10 or x > 0 or \ x < 100: print 'True'引用PEP8:包装长行的首选方法是在括号,方括号和花括号内使用Python的隐含行连续性。如有必要,可以在表达式周围添加一对额外的括号,但是有时使用反斜杠看起来更好。确保适当缩进续行。围绕二进制运算符的首选位置是在运算符之后,而不是在运算符之前。