python3爬取Post页面时, 报以下错误
"POST data should be bytes or an iterable of bytes. It cannot be of type str."
解决方案:
需要在urlencode语句后加encode(encoding='UTF8')
data = urllib.parse.urlencode(values).encode(encoding='UTF8')
"POST data should be bytes or an iterable of bytes. It cannot be of type str."
需要在urlencode语句后加encode(encoding='UTF8')
data = urllib.parse.urlencode(values).encode(encoding='UTF8')