|
3鱼币
用win10操作没有任何问题,回家想做作业换了mac打开文件就一直报错,刚开始以为中文路径的问题,改了系统语言还是依然报错。百度了几个小时依然不行,试了改encoding等方法均无效,求大神帮忙。谢谢
- Traceback (most recent call last):
- File "<pyshell#0>", line 1, in <module>
- f = open('Macintosh HD⁩/Users⁩/tengda⁩/Downloads/OpenMe.mp3⁩')
- FileNotFoundError: [Errno 2] No such file or directory: 'Macintosh HD\u2069/Users\u2069/tengda\u2069/Downloads/OpenMe.mp3\u2069'
复制代码
请确认:OpenMe.mp3 文件是否存在?
f = open(r'Macintosh HD/Users/tengda/Downloads/OpenMe.mp3')
奇怪,不加r应该也没有差别的呀?
请看下:
import os
print(os.path.exists('Macintosh HD/Users/tengda/Downloads/OpenMe.mp3'))
|
最佳答案
查看完整内容
请确认:OpenMe.mp3 文件是否存在?
f = open(r'Macintosh HD/Users/tengda/Downloads/OpenMe.mp3')
奇怪,不加r应该也没有差别的呀?
请看下:
import os
print(os.path.exists('Macintosh HD/Users/tengda/Downloads/OpenMe.mp3'))
|