class Student(Person):
def __init__(self,name,age,grade):
Person.__init__(self,name,age)
self.grade=grade
s = Student("ROY",100,2007)
print(s.p) 文件操作
poem='''
This is just
a test
for string file'''
f = open("G:/poem.txt","w")
f.write(poem)
f.close()
写文件
f = open("G:/poem.txt","r")
while True:
line=f.readline()
if len(line)==0:
break
print(line)
f.close()
True和False首字母都为大写 异常处理
try:
Print("-----")
except:
print("error")
finally:
print("finally")