Python repr() 函数
描述
repr() 函数将对象转化为供解释器读取的形式。
语法
以下是 repr() 方法的语法:
repr(object)
参数
- object -- 对象。
返回值
返回一个对象的 string 格式。
实例
以下展示了使用 repr() 方法的实例:
>>>s = 'facesoho'
>>> repr(s)
"'facesoho'"
>>> dict = {'facesoho': 'facesoho.com', 'google': 'google.com'};
>>> repr(dict)
"{'google': 'google.com', 'facesoho': 'facesoho.com'}"
>>>
尊贵的董事大人
英文标题不为空时 视为本栏投稿
需要关键字 描述 英文标题