In [482]: nextfile='../mydir/file1'
In [483]: with open(nextfile, 'w') as f:
...: pass
-
IOError Traceback (most recent call last)
<ipython-input-483-fa56c00ac002> in <module>()
> 1 with open(nextfile, 'w') as f:
2 pass
IOError: [Errno 2] No such file or directory: '../mydir/file1'
我在复制错误:
^{pr2}$open(name, ...)
中的name
应该是文件名或绝对路径,不允许有相对路径。如果路径../mydir
存在,请尝试以下操作:或使用文件的绝对路径打开:
相关问题 更多 >
编程相关推荐