PFP191Xuất hiện trong 1 đề thi
Which of the following is a correct way to open a file and ensure it is closed properly?
Các lựa chọn
A```python
with open("file.txt", "r") as file:
```
B```python
open("file.txt", "r").close()
```
C```python
file = open("file.txt", "r")
```
D```python
open("file.txt", "r", autoclose=True)
```