Page 1 of 1

Python: Reading a File

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

Code: Select all

with open("school_grades.txt) as school_grades_dot_txt:

print(school_grades_dot_txt.readline())

# In this form, the file is automatically closed after reading.