Skip to content

Instantly share code, notes, and snippets.

@muzizongheng
Created July 18, 2013 06:00
Show Gist options
  • Save muzizongheng/6027005 to your computer and use it in GitHub Desktop.
Save muzizongheng/6027005 to your computer and use it in GitHub Desktop.
http encode/decode
import base64
from http import cookiejar
import urllib.request, urllib.parse, urllib.error
url = "http://blog.csdn.net/muzizongheng"
en = urllib.parse.quote(url)
print(en)
de = urllib.parse.unquote(en)
print(de)
en = "http%3A%2F%2Fblog.csdn.net%2Fmuzizongheng"
de = urllib.parse.unquote(en)
print(de)
data = {
'key1':"value1",
'key2':"value2"
}
print(urllib.parse.urlencode(data))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment