python3.x执行post请求时报错“POST data should be bytes or an iterable of bytes...”的解决方法
2016-06-27 11:06
591 查看
使用python3.5.1执行post请求时,一直报错"POST data should be bytes or an iterable of bytes. It cannot be of type str.",仔细对照教程后也未发现编写方法没有问题。
最后通过交流发现需要加在urlencode语句后加encode(encoding='UTF8')
eg:
params = urllib.parse.urlencode({'userid':'381fccbd776c4deb'}).encode(encoding='UTF8')
问题解决
最后通过交流发现需要加在urlencode语句后加encode(encoding='UTF8')
eg:
params = urllib.parse.urlencode({'userid':'381fccbd776c4deb'}).encode(encoding='UTF8')
问题解决
相关文章推荐
- Python(八)进程、线程、协程篇
- Python遍历文件夹
- Python(2)
- Python教程之全局变量用法
- Python3内置函数实例解析
- binary_search() in python
- python scikit learn 模板
- Python用QQ邮箱发送邮件时授权码问题
- Python基本数据类型
- python基础1
- Python自省(反射)指南
- Python线程指南
- 【转】Python Twisted介绍
- Python_week#4_quiz4b_question9
- Python_week#4_quiz4b_question7
- Emacs Python 自动补全--Elpy
- Python opencv(1) 显示图像
- selenium+python测试
- python 学习简记《编程导论》CH2&CH3
- python设计模式大全