使用with打開文件

讀文件:ide

with open("a.txt") as file:
data = file.read()it

寫文件:class

with open("a.txt") as f:
f.write("hello")file

相關文章
相關標籤/搜索