“Python func str”的版本间差异

本页内容
上一节: Python3_func_open 下一节: Python_func_bool
(创建页面,内容为“{{DISPLAYTITLE:str(x)}}4 = Python str() 函数 = Python 内置函数 == 描述 == str() 函数将对象转化为适于人阅读的形式。 === 语法 === 以下是 str() 方法的语法: <sample title="" desc="" lang="python" hererun="1"> class str(object='') </sample> === 参数 === * object -- 对象。 === 返回值 === 返回一个对象的string格式。 以下展示了使用 str()…”)
 
Neo讨论 | 贡献
无编辑摘要
 
(未显示同一用户的1个中间版本)
第1行: 第1行:
{{DISPLAYTITLE:str(x)}}[[Category:python3 data type|4]]
{{DISPLAYTITLE:str()}}[[Category:python3 built in functions|24]]
= Python str() 函数 =
= Python str() 函数 =


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


<sample title="" desc="" lang="python" hererun="1">  
<sample title="" desc="" lang="python" hererun="1">
>>>s = 'XiaoBai.Wang'
>>>s = 'XiaoBai.Wang'
>>> str(s)
>>> str(s)
第33行: 第33行:
"{'google': 'google.com', 'xiaobai': 'xiaobai.wang'}"
"{'google': 'google.com', 'xiaobai': 'xiaobai.wang'}"
>>>
>>>
  </sample>
</sample>
[[python built in functions|Python 内置函数]]
[[python built in functions|Python 内置函数]]

2022年8月17日 (三) 21:49的最新版本

Python str() 函数

Python 内置函数

描述

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

语法

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


示例

class str(object='')

参数

  • object -- 对象。

返回值

返回一个对象的string格式。

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


示例

>>>s = 'XiaoBai.Wang'
>>> str(s)
'XiaoBai.Wang'
>>> dict = {'xiaobai': 'xiaobai.wang', 'google': 'google.com'};
>>> str(dict)
"{'google': 'google.com', 'xiaobai': 'xiaobai.wang'}"
>>>

Python 内置函数

上一节: Python3_func_open 下一节: Python_func_bool
此页面最后编辑于2022年8月17日 (星期三) 21:49。