首页
mac
it
登录
6mi
u
盘
搜
搜 索
it
python:open r可以读取到文件数据,但a+读取不到
python:open r可以读取到文件数据,但a+读取不到
mac
2022-06-30
21
打开模式为a+,读取不到数据
file=open('thord.txt','a+',encoding='utf-8') res=file.read() print(res) file.close()
控制台无打印信息
为什么a+读不到数据呢,a+也是读写呀?---原因:a+模式打开文件指针在文件结尾处,所以直接读是读不到内容的
转载请注明原文地址: https://mac.8miu.com/read-69000.html
最新回复
(
0
)