使用python3.5.1執行post請求時,一直報錯"POST data should be bytes or an iterable of bytes. It cannot be of type str.",仔細對照教程後也未發現編寫方法沒有問題。python
最後經過交流發現須要加在urlencode語句後加encode(encoding='UTF8')
eg:post
params = urllib.parse.urlencode({'userid':'381fccbd776c4deb'}).encode(encoding='UTF8')
原文:https://blog.csdn.net/dushu990/article/details/51767189url