What I want to do is:
I have a directory name and file name. I want to add them to a URL and make a URL call. Lets say the directory is
D:/somedir/userdata/scripts
and the file name is myscript.txt
I want to add these as parameters to URL call but I want to encode them separately and not as key value pair. What I want is a function which can take input like:
D:/somedir/userdata/scripts
and return output like:
D%3A%2Fsomedir%2Fuserdata%2Fscripts
In Python 3:
>>> import urllib.parse
>>> urllib.parse.quote_plus('D:/somedir/userdata/scripts')
'D%3A%2Fsomedir%2Fuserdata%2Fscripts'
In Python 2:
>>> import urllib
>>> urllib.quote_plus('D:/somedir/userdata/scripts')
'D%3A%2Fsomedir%2Fuserdata%2Fscripts'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With