早上好,我可以指出如何在python中进入一个内部硬盘的路径,目前使用语句:
file = GETfile() or 'http://**********'
我想放一个本地文件的路径,但它不起作用,我哪里错了?
file = GETfile() or 'D:\xxx\xxxx\playlist\playlist.m3u'
最佳答案
\
是转义符。你有三个选择。
1) 使用/
。这作为奖励也适用于 linux:
'D:/xxx/xxxx/playlist/playlist.m3u'
2) 转义反斜杠
'D:\\xxx\\xxxx\\playlist\\playlist.m3u'
3) 使用原始字符串:
r'D:\xxx\xxxx\playlist\playlist.m3u'
关于python - 你如何在python中定义本地路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42386322/