How can I encode a string so that I can pass the encoded string in url params?
use urllib.quote_plus function. Here is an example:
#!/usr/bin/python
print "Content-Type: text/html;charset=utf-8";
print
import urllib
str = "Hello World?"
str = urllib.quote_plus(str)
print str
Output: Hello+World%3F
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