import urllib.request
import urllib.parse
posturl="http://www.iqianyue.com/mypost"
postdata=urllib.parse.urlencode({
"name":"ceo@example.com",
"pass":"asdfjlkjlknhasd",
}).encode("utf-8")
req=urllib.request.Request(posturl,postdata)
rst=urllib.request.urlopen(req).read().decode("utf-8")
print(rst)
fh=open("E:\\python_spider\\tmp\\test.html", 'w')
fh.write(rst)
网友评论