以下展示了使用 repr() 方法的实例:
>>>s = 'RUNOOB'
>>> repr(s)
"'RUNOOB'"
>>> dict = {'runoob': 'runoob.com', 'google': 'google.com'};
>>> repr(dict)
"{'google': 'google.com', 'runoob': 'runoob.com'}"
>>>
返回一个对象的 string 格式
以下展示了使用 repr() 方法的实例:
>>>s = 'RUNOOB'
>>> repr(s)
"'RUNOOB'"
>>> dict = {'runoob': 'runoob.com', 'google': 'google.com'};
>>> repr(dict)
"{'google': 'google.com', 'runoob': 'runoob.com'}"
>>>
返回一个对象的 string 格式
本文标题:repr() 函数
本文链接:https://www.haomeiwen.com/subject/qlpebftx.html
网友评论