Python中 IOError: [Errno 2] No such file or directory的解决方法

IOError: [Errno 2] No such file or directory: 'D:\\Users\\daimao\\Desktop\\1.xls'

出现这种情况,首先查看目录是否有错,该目录文件是否存在。

其次在Python中“\”会被自动认为是转义字符,而非目录分隔符,此时修改为'D:\\Users\\daimao\\Desktop\\1.xls'即可。


猜你喜欢

转载自blog.csdn.net/qq_38513966/article/details/79130617