|
楼主 |
发表于 2021-9-16 20:17:57
|
显示全部楼层
- class temp:
- def __init__(self,time):
- self.count = time
- def get(self):
- return self.count
- def set(self,time1):
- self.count = time1
- def delete(self):
- del self.count
- print ('已删除')
- p = property(get,set,delete,'修饰符property的使用')
- #a = Foo(10)
- #print (a.get)
- #a.get = 20
- #print (a.get)
- b = temp(5)
- #print (b.p)
- #b.p = 10
- #print (b.p)
- #print (b.__dict__)
- #del b.p
- #print (b.__dict__)
- print (b.p.__doc__)
复制代码
我改成运行后返回:
int([x]) -> integer
int(x, base=10) -> integer
Convert a number or string to an integer, or return 0 if no arguments
are given. If x is a number, return x.__int__(). For floating point
numbers, this truncates towards zero.
If x is not a number or if base is given, then x must be a string,
bytes, or bytearray instance representing an integer literal in the
given base. The literal can be preceded by '+' or '-' and be surrounded
by whitespace. The base defaults to 10. Valid bases are 0 and 2-36.
Base 0 means to interpret the base from the string as an integer literal.
>>> int('0b100', base=0)
4
没懂为啥会返回这个,我想让他返回property里面我输入的文本 |
|