这两种是错的
# print '11' # 'tset3'#error # print '12'# +'tset4'#error
python跨行用()和\都能实现。+只是连接不支持跨行。
下面的测试代码,包含了基本可能出现的情况'''
@author: willard ''' print '1'+"tset" print '2'"tset1" print ('3' "tset1") print ('4', 'tset1') print '5' "tset1" print '5'\ 'tset2' print '5'\ 'tset3' print '6'+\ "tset" print '7'+\ "tset" print '8'\ +"tset" print '9'\ +"tset" print '10\ tset1' print '10\tset2'
输出结果为:
1tset
2tset1 3tset1 ('4', 'tset1') 5 5tset2 5tset3 6tset 7tset 8tset 9tset 10tset1 10 tset2