Python repr() 函数

Python 教程 · 2019-02-01 16:58:45

描述

repr() 函数将对象转化为供解释器读取的形式。

语法

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

repr(object)

参数

  • object -- 对象。

返回值

返回一个对象的 string 格式。

实例

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

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

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

查看所有标签

Learning Web Design

Learning Web Design

Jennifer Niederst Robbins / O'Reilly Media / 2007-6-15 / USD 44.99

Since the last edition of this book appeared three years ago, there has been a major climate change with regard to web standards. Designers are no longer using (X)HTML as a design tool, but as a means......一起来看看 《Learning Web Design》 这本书的介绍吧!

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

URL 编码/解码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

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

html转js在线工具