Đóng file mở trong Python, gọi hàm close trên object file.
Ví dụ
>>> f = open('hello.txt', 'r')
>>> # Làm việc với file
>>> f.close()
Khuyến khích không mở file cách này vì không an toàn. Dùng with ... open.
Ví dụ
with open('hello.txt', 'r') as f:
print(f.read())
File tự đóng ngay khi thoát block with.