Python 文件 IO
Python 文件 IO的例子
以下代码演示了Python基本的文件操作,包括 open,read,write:
# Filename : example.py
# DateTime : 2020-07-20
# author by : www.lidihuo.com
# 写文件
with open("test.txt", "wt") as out_file:
out_file.write("欢迎来到立地货平台!")
# Read a file
with open("test.txt", "rt") as in_file:
text = in_file.read()
print(text)
执行以上代码输出结果为: