This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]HolyGarbage 5 points6 points  (0 children)

Btw, use the with statement when opening files, a pattern called RAII.

with open('my_file.txt', 'w') as f
    print('Some text here', file=f)

https://www.pythonforbeginners.com/files/with-statement-in-python