#__author__ = 'DouYunQian' #coding = utf - 8 class Page (): def __init__ ( self , all_count ): self . all_count = all_count @ property #这是特性,这是Python中的特性 def all_pager ( self ): a1 , a2 = divmod ( self . all_count , 11
#coding=utf-8
class Page():
def __init__(self,all_count):
self.all_count=all_count
@property#这是特性,这是Python中的特性
def all_pager(self):
a1,a2=divmod(self.all_count, 11)
if a2==0:
return a1
else:
return a2
p=Page(101)
result=p.all_pager#就在也不用加括号了这就是Python中property属性
print(result)