Difficult-Rocket/tests/class_check.py

30 lines
416 B
Python
Raw Normal View History

2021-11-07 20:52:13 +08:00
"""
writen by shenjackyuanjie
mail: 3695888@qq.com
github: @shenjackyuanjie
gitee: @shenjackyuanjie
"""
class Test:
def __init__(self, a):
self.name = 'shenjackyuanjie'
self.a = a
@property
def value(self):
return self.name
def __str__(self):
return str(self.a)
def __int__(self):
return int(self.a)
abc = Test(1.23)
print(int(abc))
print(abc)