2019-02-18
阅读量:
706
如何处理文件路径中的\
如何处理文件路径中的 \ ?
print("c:\nowhere")
结果:
c:
owhere
答:可以再加 \ 来禁止特殊字符转义
print("c:\\nowhere")
c:\nowhere
但是如果路径比较长这个方法是不好操作的。还有一种办法 在字符串前面加r
print(r"c:\nowhere")
c:\nowhere






评论(0)


暂无数据
推荐帖子
0条评论
0条评论
0条评论