开发者

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)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜