【python】 中單引號,雙引號,三個雙引號的差別

單引號&雙引號 print "hello, world"print 'hello, world'是一樣的。

單引號特殊用途:英語中的單引號的使用。如 print 'hello, dogs' world' 是錯誤的,而 print "hello, dogs' world"是正確的。

三個雙引號的用途:可以用真是的回車代替\n。如print "hello, \nbig \nworld" 看起來就不是很舒服,於是引入了更易於人閱讀的寫法,如
print """hello,
big
world"""

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章