#python2 写法
import urllib
urllib.urlencode({'key1': 'value1', 'key2': 'value2'})
#python3 写法
import urllib.parse
urllib.parse.urlencode({'key1': 'value1', 'key2': 'value2'})
# 输出
'key1=value1&key2=value2
关注公众号「Python之禅」,回复「1024」免费获取Python资源
#python2 写法
import urllib
urllib.urlencode({'key1': 'value1', 'key2': 'value2'})
#python3 写法
import urllib.parse
urllib.parse.urlencode({'key1': 'value1', 'key2': 'value2'})
# 输出
'key1=value1&key2=value2
关注公众号「Python之禅」,回复「1024」免费获取Python资源