如何从文件路径中删除%20? [英] How to remove %20 from the file path?

查看:84
本文介绍了如何从文件路径中删除%20?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

file:///home/ashu/Music/Collections/randomPicks/ipod%20on%20sep%2009/Coldplay-Sparks.mp3

如何转换上述字符串以获取可以传递给open()函数的普通文件路径?

How can I convert a string like the above to get the normal file path which I can pass to open() function?

推荐答案

看看 url2pathname :

import urllib2

path = urllib2.url2pathname("file:///home/ashu/Music/Collections/randomPicks/ipod%20on%20sep%2009/Coldplay-Sparks.mp3")

这篇关于如何从文件路径中删除%20?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆