#Python(039)分行符號
'''
處理字串長度多於一行時可使用
三個單引號、雙引號,可在末段
加上"\"符號。
'''
ch1 = '''ch1:Whether all this is good for consumers
or innovation remains to be seen.'''
ch2 = """ch2:Whether all this is good for consumers
or innovation remains to be seen."""
ch3 = '''ch3:Whether all this is good for consumers'''
'''or innovation remains to be seen.'''
ch4 = '''ch4:Whether all this is good for consumers\
or innovation remains to be seen.'''
ch5 = ('ch5:Whether all this is good for consumers'
'or innovation remains to be seen.')
ch6 = ('ch6:Whether all this is good for consumers\
or innovation remains to be seen.')
print(ch1) #三單引號沒有分行符號
print(ch2) #三雙引號沒有分行符號
print(ch3) #三單引號有分行符號
print(ch4) #兩個三單引號沒有分行符號
print(ch5) #一小括弧兩個單引號沒有分行符號
print(ch6) #一小括弧一個單引號有分行符號
結果為:
留言列表