str python是什么意思

str python是什么意思,第1张

str python是什么意思

str python是什么意思?

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 python是什么意思的详细内容,

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/683433.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-20
下一篇 2022-04-20

发表评论

登录后才能评论

评论列表(0条)

保存