pythonbook/10个编程技巧/with 语句.py

4 lines
100 B
Python

#自动关闭文件
with open('mytest.txt') as file_in:
for line in file_in:
print(line)