gpt4 book ai didi

python - 插入 python 查询

转载 作者:行者123 更新时间:2023-11-30 22:59:38 26 4
gpt4 key购买 nike

我有一个名为 mylist 的列表,生成结果为 (1, 2, 3, 4)

有没有一种好的方法可以编写查询以仅使用整个列表作为值。

我知道的唯一方法是

INSERT INTO table (col1,col2,col3,col4) VALUES ('%s','%s','%s','%s') % (mylist[0],mylist[1],mylist[2],mylist[3])

最佳答案

我想这应该可行:

"INSERT INTO table (col1,col2,col3,col4) VALUES ('%s','%s','%s','%s')" % tuple(mylist)

关于python - 插入 python 查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24658436/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com