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

猜你喜欢

转载自blog.51cto.com/3633188/2162622