求debug简单的类 说name 'Student' is not defined?
class Student():name = ''
age = 0
def print_file(self):
print("name:" + self.name)
print("age:" + str(self.age))
student = Student()
student.print_file() class Student():
name = ''
age = 0
def print_file(self):
print("name:" + self.name)
print("age:" + str(self.age))
student = Student()
student.print_file() age是整形不是字符串,需要str变成字符串
2楼正解 青出于蓝 发表于 2020-7-3 14:27
age是整形不是字符串,需要str变成字符串
2楼正解
对的谢谢 而且
student = Student()
student.print_file()
这些类方法调用/使用 放到外面一个模块去~我 的缩进=。=
页:
[1]