场景:

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的更多相关文章

  1. python unicode字节串转成中文问题

    如题,其实我的问题很简单,就是在写爬虫的时候拿到网页的信息包含类似“\u65b0\u6d6a\u5fae\u535a\u6ce8\u518c”的字符串,实际上这是unicode的中文编码,对应的中文为 ...

  2. MongoDB - Introduction to MongoDB, Documents

    MongoDB stores data records as BSON documents. BSON is a binary representation of JSON documents, th ...

  3. abiword Related Pages

    Application Framework The 'af' directory contains all source code for the cross-platform application ...

  4. go语言操作mongodb

    Install the MongoDB Go Driver The MongoDB Go Driver is made up of several packages. If you are just ...

  5. nosql_action

    ps -aux  查当前端口占用 connecting to: test > show dbs local .078125GB testphp .203125GB > use testph ...

  6. Python2.7.6标准库内建函数

        Built-in Functions     abs() divmod() input() open() staticmethod() all() enumerate() int() ord( ...

  7. 【GoLang】GO语言系列--002.GO语言基础

    002.GO语言基础 1 参考资料 1.1 http://www.cnblogs.com/vimsk/archive/2012/11/03/2736179.html 1.2 https://githu ...

  8. ExtJS4笔记 Data

    The data package is what loads and saves all of the data in your application and consists of 41 clas ...

  9. andriod 开发记录apidemos 错误解决

    android sdk 里面有simple 文件夹里面有对应的demo  但是拿出来esplise运行报错 解决方案如下 右键错误代码goto,给对应错误的单引号前加 \ 原文http://stack ...

随机推荐

  1. Python2 cmp() 函数

    描述 cmp(x,y) 函数用于比较2个对象,如果 x < y 返回 -1, 如果 x == y 返回 0, 如果 x > y 返回 1. 语法 以下是 cmp() 方法的语法: cmp( ...

  2. [转载]Class-AB Amplifier 笔记

    Class-AB Amplifier 笔记 Reading Notes from Mikko Loikkanen “Design and Compensation of High Performanc ...

  3. Nodejs 使用 Chrome DevTools 调试 --inspect-brk

    参考链接: https://cnodejs.org/topic/5a9661ff71327bb413bbff5b https://github.com/nswbmw/node-in-debugging ...

  4. Linux数据库:MYSQL启用和查看二进制日志

    在/etc/my.cnf文件中[mysqld]下加上: server-id = 1 (在整个Mysql集群中保证唯一) log-bin = binlog  log-bin-index = binlog ...

  5. Hadoop2.5.2源码编译及导入Eclipse

    前言:由于官网提供的64位hadoop是没有编译的,所以当我们用到64位的hadoop时,需要在自己的64位linux系统上编译hadoop源码.另外,要想在eclipse里查看hadoop源码,修改 ...

  6. CentOS配置SSH远程连接

    本文为大家介绍Centos中配置SSH远程连接的方法,只是简单配置,供初学者参考. 1.配置IP#setup 选择 NetWork configuration 选择 Device configurat ...

  7. Direct-X学习笔记--三维摄像机

    一.介绍 哇! 到了传说中的3D摄像机啦! 之前我们写的东东,都是观察点不动,通过世界变换让东西动,今天,通过三维摄像机我们就能够改变我们的观察点,观察方向,任意在三维空间中驰骋.之前我们所设定的视角 ...

  8. ThinkPad 预装win8换win7(软激活)

    今天晚上有人叫我给他装系统,没错!这就是计算机专业的拿手技能(维修学院重装系统专业Win7系统班^-^). 一拿手上,是lenovo的ThinkPad E430型号,预装的系统是win8,由于win8 ...

  9. 深入浅出分析MySQL常用存储引擎

    MyISAM是MySQL的默认数据库引擎(5.5版之前),由早期的ISAM(Indexed Sequential Access Method:有索引的顺序访问方法)所改良.虽然性能极佳,但却有一个缺点 ...

  10. 阅读ANSI C,寻找乐趣和裨益——const char **与char **为何不兼容

    #include<stdio.h> void foo1(const char**p) { } void foo2(const char*p) { } int main(int argc,c ...