1. 首页
  2. 数据库
  3. 其它
  4. __str__和__repr__的理解

__str__和__repr__的理解

上传者: 2020-12-31 18:21:33上传 PDF文件 20.73KB 热度 12次
类1,一张扑克 class Card(object): # 一张牌 def __init__(self, color, point): self._color = color self._point = point def __str__(self): print("str", end=",") return self._color + str(self._point) def __repr__(self): print("repr", end=",") if se
下载地址
用户评论