Post页面爬取失败__编码问题

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')

  

猜你喜欢

转载自www.cnblogs.com/amou/p/9134425.html