开发者

Can I get SQLite to string instead of unicode for TEXT in Python?

开发者 https://www.devze.com 2023-01-15 01:07 出处:网络
开发者_运维知识库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 lit

开发者_运维知识库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

精彩评论

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