I have to percent encode only #
character if it appears in a given url. I know that we can encode a URL using urllib.quote
. It takes a safe
keyword to set a particular character to be safe for the URL. I am looking for something like:
a = 'http://localhost:8001/3.0/lists/list_1.localhost.org/roster/owner#iammdkdkf'
b = urllib.quote(a,unsafe='#')
Regards.
How about a.replace('#','%23')
?