Python str() 函数

Python 教程 · 2019-02-01 16:42:19

描述

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

语法

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

class str(object='')

参数

  • object -- 对象。

返回值

返回一个对象的string格式。

实例

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

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

点击查看所有 Python 教程 文章: https://codercto.com/courses/l/8.html

查看所有标签

Types and Programming Languages

Types and Programming Languages

Benjamin C. Pierce / The MIT Press / 2002-2-1 / USD 95.00

A type system is a syntactic method for automatically checking the absence of certain erroneous behaviors by classifying program phrases according to the kinds of values they compute. The study of typ......一起来看看 《Types and Programming Languages》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

html转js在线工具
html转js在线工具

html转js在线工具