Page 1 of 1

Python: Writing a File

Posted: Thu Apr 16, 2026 6:35 pm
by Jason

Code: Select all

with open("school_grades.txt", "w") as school_grades_dot_txt:

school_grades_dot_txt.write("Larry: Grade = 3.5")
 
# The code above erased and replaced whatever was on the file.