Python: Reading a File

Post Reply
User avatar
Jason
Site Admin
Posts: 767
Joined: Sun Dec 21, 2025 8:56 pm

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.

 

POSTREACT(ions) SUMMARY

Post Reply