将Python变量值插入MySql选项卡

2024-04-19 21:58:07 发布

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

在使用MySql连接器和Python时,如何将Python变量值插入MySql表?在

示例:

data = 5

cursor.execute("""INSERT INTO table1 VALUES ( data )""")

我想将'data'的值插入表名'table1'


Tags: 示例executedatamysqlcursorinsertvaluesinto