你好,我有一个名为学生.txt内有姓名。你知道吗
Buddy Mike Freshman 3.00
Allen Hood Sophmore 3.45
Dave Beck Freshman 3.00
Jose Sanford Sophmore 3.45
Juan Castro Freshman 3.00
我想将用户输入的信息添加到现有文件students中,并用新内容打印出来。你知道吗
def add_Student():
myNames = []
Name = input("Enter First and Last Name of Sudent: ")
Status = input("Enter Status of Stdent: ")
GPA = input("Enter Students GPA: ")
newStudent = Student.Student(Name, Status, GPA )
print("Student' Name: ",newStudent.getName())
print("Student' Status: ",newStudent.getStatus())
print("Student' GPA: ",newStudent.getGPA())
要将数据附加到文件中,请使用选项“a”打开该文件:
相关问题 更多 >
编程相关推荐