I have a URL that points to a local file.
'file:///home/pi/Desktop/music/Radio%20Song.mp3'
I need to somehow convert this into a traditional file path, like the os
module employs.
'/home/pi/Desktop/music/Radio Song.mp3'
Right now I'm hacking it with the replace()
method.
path = file.replace('file://', '').replace('%20', ' ')
I've looked at the os
module, and it doesn't seem to have support for this. I've searched various ways of phrasing it, and I can't seem to find an answer. Am I just ignorant of the terminology? What's the proper way to do this?