热线电话:13121318867

登录
2019-02-18 阅读量: 706
如何处理文件路径中的\

如何处理文件路径中的 \ ?

print("c:\nowhere")

结果:

c:

owhere

答:可以再加 \ 来禁止特殊字符转义

print("c:\\nowhere")
c:\nowhere

但是如果路径比较长这个方法是不好操作的。还有一种办法 在字符串前面加r

print(r"c:\nowhere")
c:\nowhere
0.0000
4
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子