f=open('message1.txt','r')Traceback(mostrecentcalllast):File"<pyshell#0>",line1,in<module>f=open('message1.txt','r')FileNotFoundError:[Errno2]Nosuchfileordirectory:'messa... f=open('message1.txt','r')Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> f=open('message1.txt','r')FileNotFoundError: [Errno 2] No such file or directory: 'message1.txt'总是会出现No such file or directory怎么打开文件阿
1 回答
![?](http://img1.sycdn.imooc.com/54584c5e0001491102200220-100-100.jpg)
芜湖不芜
TA贡献1796条经验 获得超7个赞
我们需要新建一个文本文档,这个文档可以是windox自带的记事本;
然后我们在其中输入一些我们想要的信息;
新建好文档之后,我们需要点击另存为,把文件保存在一个你知道的地方;
保存的时候,请注意保存格式,不然有可能python打不开;
然后我们打开python的一个编辑器,IDLE;
在编辑器中输入一下的信息就可以打开文件了;
read是文件读取,seek是文件的指针重新指到最前面,close是文件关闭。
添加回答
举报
0/150
提交
取消