How to remove from the file path?

后端 未结 2 768
忘掉有多难
忘掉有多难 2021-01-06 07:40
file:///home/ashu/Music/Collections/randomPicks/ipod%20on%20sep%2009/Coldplay-Sparks.mp3

How can I convert

相关标签:
2条回答
  • 2021-01-06 07:49

    This is called unquote. Avaiable from urllib.

    import urllib
    urllib.unquote('%20')
    
    0 讨论(0)
  • 2021-01-06 08:07

    Have a look at url2pathname:

    import urllib2
    
    path = urllib2.url2pathname("file:///home/ashu/Music/Collections/randomPicks/ipod%20on%20sep%2009/Coldplay-Sparks.mp3")
    
    0 讨论(0)
提交回复
热议问题