Я застрял в этой проблеме python часами. Я пытаюсь понять, как записать данные, которые могут быть введены вручную в файл txt, таким образом, чтобы они отображались в таблице из двух столбцов. Содержимое в name_array должно быть заголовком, а содержимое в data_array - это фактические части данных.Как отображать данные в табличном формате в txt-файле
name = str(raw_input("Enter the student's name: "))
medianScore = float(raw_input("Enter the median group score for quizzes:"))
indScore = float(raw_input("Enter the score of the individual quiz: "))
assignmentScore = float(raw_input("Enter the score of the assignment: "))
test1Score = float(raw_input("Enter the score of exam one: "))
test2Score = float(raw_input("Enter the score of exam two: "))
test3Score = float(raw_input("Enter the score of the final exam: "))
fileName = str(raw_input("Enter the name of the file you would like to create: "))
f = file(fileName + ".txt" , a)
finalScore = ((medianScore * .14) + (indScore * .14) + (assignmentScore * .12) + (test1Score * .15) +(test2Score * .20) + (test3Score * .25))
data_array = [name, finalScore, test3Score, test1Score, test2Score, assignmentScore, indScore, medianScore]
name_array = [ "Student", "Final Grade", "Final Exam", "Exam 1", "Exam 2", "Assignments", "Solo Quizzes", "Group Quizzes"]
Вы можете исправить параметр 'a' в' файле' – Batsu