單引號雙引號和三引號的區別 單引號,雙引號和三引號的區別?

【單引號雙引號和三引號的區別 單引號,雙引號和三引號的區別?】1. 單引號和雙引號用法都是一樣的,但是如果字符串里有相同的字符時要使用\進行轉義舉例:1) print 'hello'2) print "hello"1和2,結果都是hello3) print 'hell\'o'4) print "hell'o"3和4,結果都是hell'o5) print 'hell"o'6) print "hell\"o"5和6,結果都是hell"o2. 三引號與他們不同之處:“所見即所得”,對于一段html或xml格式的字符串時用三引號更直觀點(此時要用單引號或雙引號時候需要進行轉義)如:print '''hello'world"'''結果是hello'world"

    推薦閱讀