好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

str函数的功能

Python中str函数的功能

str() 函数将对象转化为适于人阅读的形式。

语法

以下是 str() 方法的语法:

class str(object='') 

参数

object -- 对象。

返回值

返回一个对象的string格式。

实例

以下展示了使用 str() 方法的实例:

>>>s = 'RUNOOB'
>>> str(s)
'RUNOOB'
>>> dict = {'runoob': 'runoob.com', 'google': 'google.com'};
>>> str(dict)
"{'google': 'google.com', 'runoob': 'runoob.com'}"
>>> 

相关推荐:《Python教程》

以上就是str函数的功能的详细内容,更多请关注Gxl网其它相关文章!

查看更多关于str函数的功能的详细内容...

  阅读:40次