解决Python3.6,发送POST请求错误提示:POST data should be bytes, an iterable of bytes, or a file object. It canno
#将str类型转换为bytes类型
data = urllib.parse.urlencode(formData).encode(“utf-8”)
request = urllib.request.Request(url, data=data, headers=header)
print(urllib.request.urlopen(request).read().decode(“utf-8”))