I am new to Python and URLs
I am trying something like this in python. I need to add a string to the URL can some one please help here. If we can convert the string to URL please suggest me. I have executed above script in python.
I am looking for a hyperlink for a string in python.
8
The []=char
query param should use &
if it is a new parameter, then the []
must be url encoded.
You can use urllib.parse.urlencode
to add query parameters in the correct format.
This fully highlights as a hyperlink in PyCharm console
import urllib
'https://example.com' + '?' + urllib.parse.urlencode({'param': 'specialanother', '[]': 'char'})
# 'https://example.com?param=specialanother&%5B%5D=char'
2