#coding=utf-8
#repr方法字符串输出实例对象的值
class CountFromBy(object):

    def __init__(self, val=0, incr=1):
        self.val = val
        self.incr = incr

    def increase(self):
        self.val += self.incr

    def __repr__(self):
        return str(self.val)


>>> c = CountFromBy()
>>> c
0

 

相关文章:

  • 2022-12-23
  • 2022-02-05
  • 2022-12-23
  • 2022-12-23
  • 2021-09-20
  • 2022-01-04
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-01
  • 2023-03-18
  • 2021-09-08
  • 2022-12-23
  • 2021-12-28
  • 2022-12-23
相关资源
相似解决方案