Python将UTF8字符串插入SQLi

2024-09-29 05:30:45 发布

您现在位置:Python中文网/ 问答频道 /正文

我知道也有类似的问题,但答案是不同的和有点混乱。

我有这个绳子:

titulo = "Así Habló Zaratustra (Cómic)"

当我尝试将其插入到SQLite数据库时,会出现错误:

sqlite3.ProgrammingError: You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings.

我试过几次都没有成功。请帮忙。


Tags: 答案textyousqlitethatusefactoryas