还是以我的网页iciba为例
POST数据到www.selflink.cn/iciba/get0.php获取返回的查询结果
#coding:utf8 import urllib.request import urllib import re #中文示例 #s='你好' #s=urllib.parse.quote(s) #url = "http://www.baidu.com/s?wd=%s"%(s) url="http://www.mywebpage.site/mywebpage/iciba/get0.php" pdata={'name':'hello'} pdata=urllib.parse.urlencode(pdata) binary_data = pdata.encode('ascii') f = urllib.request.urlopen(url,binary_data) data = f.read() data = data.decode('UTF-8') print(data)