面向?qū)ο?br/>'''
十載的汕尾網(wǎng)站建設(shè)經(jīng)驗(yàn),針對(duì)設(shè)計(jì)、前端、開(kāi)發(fā)、售后、文案、推廣等六對(duì)一服務(wù),響應(yīng)快,48小時(shí)及時(shí)工作處理。營(yíng)銷(xiāo)型網(wǎng)站的優(yōu)勢(shì)是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動(dòng)調(diào)整汕尾建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無(wú)論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計(jì),從而大程度地提升瀏覽體驗(yàn)。創(chuàng)新互聯(lián)從事“汕尾網(wǎng)站設(shè)計(jì)”,“汕尾網(wǎng)站推廣”以來(lái),每個(gè)客戶項(xiàng)目都認(rèn)真落實(shí)執(zhí)行。
#類(lèi)
class bar:
def foo(self,arg):
print(self.name,self.age,self.gender,arg)
z = bar()
#封裝公有部分到內(nèi)存里
z.name = 'hao'
z.age = 11
z.gender = '男'
z.foo(666)
z1 = bar()
z.name = 'xue'
z.age= 18
z.gender = '女'
z.foo('hahaha')
'''
'''
class bar:
def __init__(self,name,age):
self.name = name
self.age = age
def show(self):
print('%s:%s' %(self.name,self.age))
z = bar('hao',11)
z.show()
z1 =bar('haha',33)
z1.show()
#輸出結(jié)果:
hao:11
haha:33
'''
#繼承
class F:
def f1(self):
print('F.f1')
def f2(self):
print('F.f2')
class s(F):
def s1(self):
print('s.s1')
def f2(self):
super(s,self).f2() #執(zhí)行父類(lèi)(基類(lèi))中的方法
print('s.f2')
h = s()
h.s1()
h.f1()
#輸出結(jié)果: s.s1 F.f1
h.f2()
#結(jié)果
F.f2
s.f2
# class foo:
# def __init__(self):
# self.name = "a"
#
# def bar(self):
# print('bar')
#
# @property
# def per(self):
# return 1
# @per.setter
# def per(self,var):
# print(var)
#
# obj = foo()
#
# r = obj.per
# # print(r)
#
# obj.per = 123
class pagenation:
def __init__(self,current_page):
try:
p = int(current_page)
except enumerate as e:
p = 1
self.page = p
@property
def start(self):
val = (self.page -1) * 10
return val
@property
def end(self):
val = self.page * 10
return val
li = []
for i in range(100000):
li.append(i)
while True:
p = input('請(qǐng)輸入你的頁(yè)碼:')
obj = pagenation(p)
print(li[obj.start:obj.end])
輸出結(jié)果
成員修飾符
'''
class F:
def __init__(self):
self.ag =12
self.__ag = 34
class S(F):
def __init__(self,name):
self.name = name
self.__age =18
super(S,self).__init__()
def show(self):
print(self.name)
print(self.__age) #間接調(diào)用私有字段
print(self.ag)
# print(self.__ag) #無(wú)法繼承父類(lèi)的私有字段
obj = S('hao')
obj.show()
'''
'''
class Foo:
def __init__(self):
print('hah')
def __call__(self, *args, **kwargs):
print('123')
def __int__(self):
return 111
def __str__(self):
return 'hao'
Foo()() #調(diào)用__call__方法
a = int(Foo()) #調(diào)用__int__方法
print(a)
b = str(Foo()) #調(diào)用__str__方法
print(b)
'''
# class Foo:
# def __init__(self,name,age):
# self.name = name
# self.age = age
# self.n = 123
# obj = Foo('hao',18)
#
# r = obj.__dict__ #結(jié)果:{'name': 'hao', 'age': 18, 'n': 123}
# print(r)
'''
class Foo:
def __init__(self,name,age):
self.name = name
self.age = age
self.n = 123
def __getitem__(self, item):
return item+10
def __setitem__(self, key, value):
print(key,value)
def __delitem__(self, key):
print(key)
obj = Foo('hao',18)
r = obj[8] #r=item
print(r) #調(diào)用__getitem方法,結(jié)果:18
obj[10]=888 #調(diào)用__setitem方法,結(jié)果:10,888
del obj[999] #調(diào)用__delitem方法,結(jié)果:999
'''
# class Foo:
#
# def __iter__(self):
#
# return iter([11,22,33,44])
# obj = Foo()
#
# for i in obj:
# print(i)
#輸出結(jié)果
# 11
# 22
# 33
# 44
新聞標(biāo)題:面向?qū)ο蠡A(chǔ)
文章位置:http://jinyejixie.com/article16/pggggg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供云服務(wù)器、電子商務(wù)、動(dòng)態(tài)網(wǎng)站、網(wǎng)站維護(hù)、網(wǎng)站設(shè)計(jì)公司、品牌網(wǎng)站設(shè)計(jì)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)