码迷,mamicode.com
首页 > 编程语言 > 详细

Python 之 str 、 repr 、 反引号(``)的区别

时间:2018-08-21 21:45:53      阅读:153      评论:0      收藏:0      [点我收藏+]

标签:引号   The   print   方式   repr   字符串   str   的区别   python   

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

Python 之 str 、 repr 、 反引号(``)的区别

标签:引号   The   print   方式   repr   字符串   str   的区别   python   

原文地址:http://blog.51cto.com/3633188/2162622

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!