Python2.7写入中文数据进sqlite3报错
来源:互联网 发布:战后心理创伤知乎 编辑:程序博客网 时间:2024/05/22 12:38
用python爬了一些中文数据想写进sqlite3数据库,但是遇到报错:
sqlite3. Programming Error: You must not use 8-bit byte strings unless you use a text_factory that can interpret 8-bit byte strings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings.
参考了两篇博客之后,得到解决
http://python.jobbole.com/81244/
http://blog.csdn.net/sbdxxcjh/article/details/38462591
报错的原因是我插入的中文数据是str类型,但sql要求插入的类型是unicode
令s = unicode(s),把字符串转换成unicode类型,不会报错了
0 0
- Python2.7写入中文数据进sqlite3报错
- 解决python2.7中文报错问题
- 解决python2.7中文报错问题
- python2.7中文编码报错问题
- 解决python2.7.x在windows系统下文件写入中文报错
- python2.7写中文数据到json文件报错UnicodeEncodeError
- linux 环境 mysql写入中文报错
- Python2.7使用Oracle插入中文字符报错问题解决方案
- Sqlite3批量写入数据到数据库中
- Python2.7 安装numpy报错解决方法
- python sqlite3 报错
- Python2.7中SQLite3的基本操作
- 向mysql数据库中写入中文,报错问题解决
- Python2.7<中文编码>
- python2.7中文编码
- python2 import urllib2报错
- python2 运行pyspider报错
- python2 pip 安装报错
- android中ContentProvider
- 孙敬哲的c++上机实验2-2
- Android权限
- zzuoj-10453: 补题栈
- 跨域中的crossdomain文件
- Python2.7写入中文数据进sqlite3报错
- 科技公司钟爱的50款开源工具--转载
- servlet错误:HTTP Status 405 - HTTP method GET is not supported by this URL
- 反射机制_介绍_Class对象获取_动态操作_构造器_方法_属性JAVA211-212
- 理想团队模式及软件流程的理解
- 第三周项目5—用递归求解
- 2.Utm-模块设计
- 数组中将所有奇数排到偶数前面
- 桶排序