遇到sqlite3问题,出现语法错误?

时间:2022-06-01 20:09:40

When using sqlite3's database, I get an error like so:

使用sqlite3的数据库时,我收到如下错误:

    File '..\database.py', line 131, in load_player_abilities
      (player.id, ability.id)):

sqlite3.OperationalError: near '=': syntax error

The error I'm getting is coming from the following piece of code:

我得到的错误来自以下代码:

for ability in player.abilities:
    for level in cursor.execute(
            "SELECT level FROM abilities"
            "WHERE player_id=? AND ability_id=?",
            (player.id, ability.id)):
        ability.level = level

1 个解决方案

#1


It seems you are missing a space between abilities and WHERE.

看来你错过了能力和WHERE之间的空间。

for ability in player.abilities:
    for level in cursor.execute(
        "SELECT level FROM abilities "
        "WHERE player_id=? AND ability_id=?",
        (player.id, ability.id)):
        ability.level = level

#1


It seems you are missing a space between abilities and WHERE.

看来你错过了能力和WHERE之间的空间。

for ability in player.abilities:
    for level in cursor.execute(
        "SELECT level FROM abilities "
        "WHERE player_id=? AND ability_id=?",
        (player.id, ability.id)):
        ability.level = level