# 、
#
# : , , 。 , 。
# : ,
# :
# : , ,
# :
# : ,
# 、
# , 。
# : , 。 ( , )
# : , 。
# : class :
# ,
# :
class sut:
sc='dagschool'
def learn(self):
print('is learing')
def __init__(self,name,sex,age): #__init__
self.Name=name
self.Sex=sex
self.Age=age
#self.Name=' '
#self.Sex=' '
#self.Age=18
def choose_cou(self):
print('choose')
#
print(sut.__dict__) #__dict__
print(sut.sc) # ,"." 。
print(sut.learn) #learn
#
sut.counttry='china'
print(sut.counttry)
#
sut.sc='DAGSCHOOL'
print(sut.sc)
#
del sut.counttry
print(sut.counttry)
# ,
sut.learn('ss')
#
#1. , , 。
#2. , , , , __init__。 :sut.__init__(sut1,' ',' ',18)
sut1=sut(' ',' ',18) #sut1
print(sut1.__dict__)
print(sut1.Name,sut1.Sex,sut1.Age)
# , , , 。 , 。
class sut:
sc='dagschool'
def learn(self,x,y):
print('%s is learing' %self.Name)
print(x,y)
def __init__(self, name, sex, age): # __init__
self.Name=name
self.Sex=sex
self.Age=age
sut1=sut(' ',' ',18) #sut1
print(sut1.__dict__)
print(sut1.Name,sut1.Sex,sut1.Age)
sut2=sut(' ',' ',8)
sut3=sut(' ',' ',181)
print(sut.learn)
print(sut1.learn)
print(sut2.learn)
print(sut3.learn)
sut1.learn(1,2)
sut.learn(sut1,1,2) #
# , 。
:
class Teac:
schoo='oldboy'
count=0
def __init__(self,name,sex,age,level,salary):
self.name=name
self.sex=sex
self.age=age
self.level=level
self.salary=salary
Teacher.count+=1
def teach(self):
print('%s is tacahing' %self.name)
t1=Teac('ii','sdf',19,56,20)
t2=Teac('tr','tf',58,60,1000)
t3=Teac('hg','aop',68,40,100)
print(t1.count)
#
g=[1,2,3,4] #g=list([1,2,3,4])
g1=list([1,2,3,4])
g2=list([1,2,3,4])
g1.append(5)
#
list.append(g1,5) #g1 self
print(g1)
#
g1.append('a')
g2.append('b')