Page 1 of 1

Python: Writing a File

Posted: Wed Aug 20, 2025 11:51 am
by The 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.