我有以下代码:
class StudentData:
"Contains information of all students"
studentNumber = 0;
def __init__(self,name,age,marks):
self.name = name;
self.age = age;
self.marks = marks;
StudentData.studentNumber += 1;
def displayStudentNumber(self):
print 'Total Number of students = ',StudentData.studentNumber;
def displayinfo(self):
print 'Name of the Student: ',self.name;
print 'Age of the Student: ', self.age;
print 'Marks of the Student: ', self.marks;
student1 = StudentData('Ayesha',12,90)
student2 = StudentData('Sarah',13,89)
print "*Student number in case of student 1*\n",student1.displayStudentNumber();
print "Information of the Student",student1.displayinfo();
print "*Student number in case of student 2*\n",student2.displayStudentNumber();
print "Information of the Student",student2.displayinfo();
输出是:
*学生1的学生编号* 学生总数 = 2 没有任何 学生信息学生姓名:Ayesha 学生年龄:12 学生成绩:90 没有任何 *学生2的学生人数* 学生总数 = 2 没有任何 学生信息学生姓名:Sarah 学生年龄:13 学生成绩:89 没有任何
我不明白为什么我的输出中会出现这些“无”。谁能解释一下?