数据库上变量的语法错误(MySQL/Python)

数据库上变量的语法错误(MySQL/Python),python,mysql,database,scrapy,Python,Mysql,Database,Scrapy,起初我声明了一个变量nom_of_game_db,但之后我在MySQL级别找不到正确的语法来回调该变量: # -*- coding: utf-8 -*- name_of_game_db = input("Name of game ?") class QuotetutorialPipeline(object): def __init__(self): self.create_connection() self.create_table()

起初我声明了一个变量nom_of_game_db,但之后我在MySQL级别找不到正确的语法来回调该变量:

    # -*- coding: utf-8 -*-

name_of_game_db = input("Name of game ?")

class QuotetutorialPipeline(object):

    def __init__(self):
        self.create_connection()
        self.create_table()

    def create_connection(self):
        self.conn = mysql.connector.connect(
                host = 'localhost',
                user = 'root',
                passwd = 'jozefleonel',
                database = 'prices'
            )
        self.curr = self.conn.cursor()

    def create_table(self):
        self.curr.execute("""DROP TABLE IF EXISTS nam_of_game_db""")
        self.curr.execute("""create table name_of_game_db(
                        name text,
                        platform text,
                        edition text
                        )""")

    def process_item(self, item, spider):
        self.store_db(item)
        return item

    def store_db(self,item):
        self.curr.execute("""insert into name_of_game_db values (%s,%s,%s)""", (
            item['name'][0],
            item['platform'][0],
            item['edition'][0]
            ))
        self.conn.commit()

在执行execute to create table语句之后,我使用Python和MySQL使用self.conn.commit提交db更改,并重命名drop table exist sql命令。

显示错误。我只想找到好的语法来调用变量的值将变量定义为全局变量