Can I get SQLite to string instead of unicode for TEXT in Python?
开发者_运维知识库AFAIK SQLite returns unicode objects for TEXT
in Python. Is it possible to get SQLite to return string objects instead?
On further inspection of the Python SQLite API, I found this little bit:
http://docs.python.org/library/sqlite3.html#sqlite3.Connection.text_factory
Case closed.
TEXT
is intended to store text. Use BLOB
if you want to store bytes.
Use Python 3.2+. It will automatically return string instead of unicode (as in Python 2.7)
精彩评论