AttributeError:' X'对象没有属性' Y'

时间:2015-04-26 04:51:06

标签: python class dictionary

这是我遇到的错误

属性错误:'学生'对象没有属性' _Student__student'

我明确地在课堂上有我的变种器:

self.__work = work
def set__work(self,work):
   self.__work = work 

def get_work(self):
   return self.__work

def add(students_info):
name = input("Enter the student name:")
ID = input("Enter student's ID:")
GPA= input("Enter GPA:")
grade = input("Enter student's expected grade:")
work = input("Does the student work part time or full time?")
students=student.Student(name, ID, GPA, grade, work)
if ID not in students_info:
    students_info[ID] = students
    print(students_info[ID])
else:
    print("Entry already existed")

我已经盯着这几个小时,但我仍然不明白为什么我会收到这段代码。很明显,我开始并回归并将工作安排到班级“学生”中。有任何想法吗?救命!谢谢

0 个答案:

没有答案