python打开和关闭文件

2022-04-24 00:00:00 文件 关闭 打开

python可以通过open函数打开文件,通过close函数关闭文件

# Open a file
fo = open("foo.txt", "wb")
print("Name of the file: ", fo.name)
# Close opend file
fo.close()

相关文章