bson.errors.InvalidStringData: strings in documents must be valid UTF-8
场景:
pymongo 查询数据库的时候报错。
for gscode in GSList_StockPool_Mongo_MktStop:
self._collection_flash.find({"ymd": nDateNow, "gscode": gscode}).count()
原因:
不是utf-8编码,gscode 取到的中文是乱码。
解决方法:
编码改为utf-8。
bson.errors.InvalidStringData: strings in documents must be valid UTF-8的更多相关文章
- python unicode字节串转成中文问题
如题,其实我的问题很简单,就是在写爬虫的时候拿到网页的信息包含类似“\u65b0\u6d6a\u5fae\u535a\u6ce8\u518c”的字符串,实际上这是unicode的中文编码,对应的中文为 ...
- MongoDB - Introduction to MongoDB, Documents
MongoDB stores data records as BSON documents. BSON is a binary representation of JSON documents, th ...
- abiword Related Pages
Application Framework The 'af' directory contains all source code for the cross-platform application ...
- go语言操作mongodb
Install the MongoDB Go Driver The MongoDB Go Driver is made up of several packages. If you are just ...
- nosql_action
ps -aux 查当前端口占用 connecting to: test > show dbs local .078125GB testphp .203125GB > use testph ...
- Python2.7.6标准库内建函数
Built-in Functions abs() divmod() input() open() staticmethod() all() enumerate() int() ord( ...
- 【GoLang】GO语言系列--002.GO语言基础
002.GO语言基础 1 参考资料 1.1 http://www.cnblogs.com/vimsk/archive/2012/11/03/2736179.html 1.2 https://githu ...
- ExtJS4笔记 Data
The data package is what loads and saves all of the data in your application and consists of 41 clas ...
- andriod 开发记录apidemos 错误解决
android sdk 里面有simple 文件夹里面有对应的demo 但是拿出来esplise运行报错 解决方案如下 右键错误代码goto,给对应错误的单引号前加 \ 原文http://stack ...
随机推荐
- Python type() 函数
描述 type() 函数如果你只有第一个参数则返回对象的类型,三个参数返回新的类型对象.类似isinstance() isinstance() 与 type() 区别: type() 不会认为子类是一 ...
- find命令之exec和xargs
exec: find是我们很常用的一个Linux命令,但是我们一般查找出来的并不仅仅是看看而已,还会有进一步的操作,这个时候exec的作用就显现出来了. exec解释: -exec 参数后面跟的是c ...
- unity update与fixedUpdate
update与渲染同步.fixedUpdate与物理同步. 在update中,speed要乘以Time.deltaTime.在fixedUpdate中,speed要乘以Time.fixedDeltaT ...
- 并发编程之socketserver模块
一.socketserver模块介绍 基于tcp套接字,关键的就是两个循环,一个是链接循环,一个是通信循环 socketserver模块中分两大类:srever类(解决链接问题)和request类(解 ...
- springcloud Ribbon自定义负载均衡插件
现在我们通过插件的方式添加新的一种策略. package com.zhuyang.config; import org.springframework.beans.factory.annotation ...
- 【OC语法快览】二、存取方法
Accessors 存取方法 All instance variables are private in Objective-C by default, so you should use acces ...
- ny37 回文字符串
回文字符串 时间限制:3000 ms | 内存限制:65535 KB 难度:4 描述 所谓回文字符串,就是一个字符串,从左到右读和从右到左读是完全一样的,比如"aba".当 ...
- Oracle PLSQL Demo - 14.定义定参数的显示游标
declare v_empno scott.emp.empno%type; v_sal scott.emp.sal%type; ) is select t.empno, t.sal from scot ...
- 游戏开发tips之RTTI(1)
首先说明标题的含义,怎么感觉就和定义一种语言一样,需要有一个规约呢..... 标题定义如下:游戏开发tip之+内容+(总tips的第几篇) 扩展如下:内容(一,二,三.....) 新手可怜,大神每一句 ...
- C#集合概述
C#集合概述 2016-11-29 集合 顺序排列 连顺存储 直接访问方式 访问时间 操作时间 备注 Dictionary 是 Key Key:O(1) O(1) 访问性能最快,不支持排序 Sorte ...