urllib获取get/post请求
from urllib.request import urlopen
from urllib.parse import urlencode
获取get请求
# url='http://www.nnzhp.cn'
# res=urlopen(url)
# print(res.read().decode())
二、获取post请求
url='http://118.24.3.40/api/user/login'
# res=urlopen(url)
# print(res.read().decode())
data={'username':'niuhanyang','passwd':'aA123456'}
# print(urlencode(data))
res=urlopen(url,urlencode(data).encode())
print(res.read().decode())