开发者

How do I url encode in Python?

开发者 https://www.devze.com 2023-02-18 21:53 出处:网络
I tried this: but it doesn\'t work. print urllib.urlencode(\"http://\"+SITE_DOMAIN+\"/go/\") I want to turn it into a stri开发者_StackOverflowng with url encodingsWere you looking for the quote() o

I tried this: but it doesn't work.

print urllib.urlencode("http://"+SITE_DOMAIN+"/go/")

I want to turn it into a stri开发者_StackOverflowng with url encodings


Were you looking for the quote() or quote_plus() function instead?

>>> urllib.quote("http://spam.com/go/")
'http%3A%2F%2Fspam.com%2Fgo%2F'


You are looking for urllib.quote().

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号