day08_python教程中,如何理解(01)属性的定义和使用?
- 内容介绍
- 文章标签
- 相关推荐
本文共计167个文字,预计阅读时间需要1分钟。
伪创新可以改写为:模仿创新。以下是改写后的开头内容,不超过100字:
模仿创新,即通过借鉴和模仿他人的成功经验,进行局部改进或创新,以实现产品或服务的创新。
#__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)
if a2==0:
return a1
else:
return a2
p=Page(101)
result=p.all_pager#就在也不用加括号了这就是Python中property属性
print(result)
本文共计167个文字,预计阅读时间需要1分钟。
伪创新可以改写为:模仿创新。以下是改写后的开头内容,不超过100字:
模仿创新,即通过借鉴和模仿他人的成功经验,进行局部改进或创新,以实现产品或服务的创新。
#__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)
if a2==0:
return a1
else:
return a2
p=Page(101)
result=p.all_pager#就在也不用加括号了这就是Python中property属性
print(result)

