Python: Appending a File
Posted: Thu Apr 16, 2026 6:44 pm
Code: Select all
with open("school_grades.txt", "a") as school_,grades_dot_txt:
school_grades_dot_txt.write("Amber: Grade = 3.8")
# This adds Amber's grade to the file. It doesn't erase what was on it before.