Python: Reading a File without Auto-Closing

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

Code: Select all

school_students_dot_txt = open("school_students.txt")

print(school_students_dot_txt.readline())

school_students_dot_txt.close()

# Line had to be created to close the file.
 

POSTREACT(ions) SUMMARY

Post Reply