使用with打开文件

读文件:ide

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

写文件:class

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

相关文章
相关标签/搜索