用类写一个课程信息系统实现增加和查找
作者:互联网
class Course():
def __init__(self,course_number,course_name,tearcher,address):
self.course_number = course_number
self.course_name = course_name
self.tearcher = tearcher
self.__address = address #私有变量
def printinfo(self):
print('course_number:'+self.course_number)
print('course_name:'+self.course_name)
print('teacher:'+self.tearcher)
print('address:'+self.__address)
information = input().split(" ")
course1 = Course(*information) #解包传参
course1.printinfo()
标签:用类,name,信息系统,self,number,course,查找,address,print 来源: https://blog.csdn.net/weixin_44022018/article/details/110739585