python--续行书写方法

来源:互联网 发布:好看的动画知乎 编辑:程序博客网 时间:2024/06/11 19:55
#方法一:三个单引号
print '方法一输出结果:'
print '''hello
_
python'''
#方法二:三个双引号
print '方法二输出结果:'
print """hello
_
python"""
#方法三:已\结尾
print '方法三输出结果:'
print 'hello\
_\
python'
#方法四:括号
print '方法四输出结果:'
print ('hello'
       '_'

       'python') 


输出结果:


方法一输出结果:
hello
_
python
方法二输出结果:
hello
_
python
方法三输出结果:
hello_python
方法四输出结果:
hello_python