Python 之 str 、 repr 、 反引號(``)的區別

str 、 repr 、 `` 、是將Python值轉換爲字符串的3種方式

>> print str("Hello, World !")
hello, world !

>>print repr("Hello, World !")
'Hello, World !'

>> temp = 2
>> print "The number is " + temp
The number is 2

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