更新时间:2022-01-07 06:04:18
f=open("README.txt","mode="r",encoding="UTF-8")
content=f.read(20)
print(content)
content2=f.read(6)print(content2)
f.close()
读取文件内容: 1.通过open函数获取文件对象 2.执行read函数 需要指定读取的字符