python csv unicode 'ascii' codec can't encode character u'\xf6' in position 1: ordinal not in range(128)

后端 未结 3 1375
野性不改
野性不改 2020-12-23 16:57

I have copied this script from [python web site][1] This is another question but now problem with encoding:

import sqlite3
import csv
import codecs
import cS         


        
3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-23 17:22

    From the documentation:

    • http://docs.python.org/library/stringio.html?highlight=cstringio#cStringIO.StringIO

    Unlike the StringIO module, this module is not able to accept Unicode strings that cannot be encoded as plain ASCII strings.

    I.e. only 7-bit clean strings can be stored.

提交回复
热议问题