Building proper link with spaces
- by Joel
Hello,
I have the following code in Python:
linkHTML = "<a href=\"page?q=%s\">click here</a>" % strLink
The problem is that when strLink has spaces in it the link shows up as
<a href="page?q=with space">click here</a>
I can use strLink.replace(" ","+")
But I am sure there are other characters which can cause errors. I tried using
urllib.quote(strLink)
But it doesn't seem to help.
Thanks!
Joel