Python str() 函数

Python 3 教程 · 2019-02-05 08:56:26

描述

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 3 教程 文章: https://www.codercto.com/courses/l/10.html

查看所有标签

Introduction to Computation and Programming Using Python

Introduction to Computation and Programming Using Python

John V. Guttag / The MIT Press / 2013-7 / USD 25.00

This book introduces students with little or no prior programming experience to the art of computational problem solving using Python and various Python libraries, including PyLab. It provides student......一起来看看 《Introduction to Computation and Programming Using Python》 这本书的介绍吧!

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

SHA 加密
SHA 加密

SHA 加密工具

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试