Python3.6,sqlite操作错误:接近;“到”语法错误

Python3.6,sqlite操作错误:接近;“到”语法错误,python,sqlite,Python,Sqlite,我真的有压力问题。这是我的密码 match_columns_allword = [hgggg,wtf,gg,lmao,hahah,ok,game,miss,click,zo,guys,please,ima,celebrity,get,me,out,of,here,someone,has,to,lose,mmr,which,you,used,glyph,damn,easy,fuck,u,all,ez,pieces,shit,d,fuckkkkkkkkk,uuu,am,pickers,izi,sni

我真的有压力问题。这是我的密码

match_columns_allword = [hgggg,wtf,gg,lmao,hahah,ok,game,miss,click,zo,guys,please,ima,celebrity,get,me,out,of,here,someone,has,to,lose,mmr,which,you,used,glyph,damn,easy,fuck,u,all,ez,pieces,shit,d,fuckkkkkkkkk,uuu,am,pickers,izi,sniper,yeah,go,on,meeeee,wp,sec,how,like,that,ld,and,aa,wala,bb,cemen,ah,ajg,ggwp,commend,ty,orge,swap,tips,isit,agin,awwoo,are,bored,stop,it,nice,tp,under,tower,ff,bear,man,broken,fucking,hero,im,sorry,cavern,x,its,fine,come,fight,pls,lol,elp,we,cannot,end,oh,dear,goddamn,notlikethis,dusts,blind,team,mooooo,thanks,missed,jesus,finally,my,god,christ,what,a,haha,asdasdasd,no]
conn = sqlite3.connect('chat.db')
cur = conn.cursor()
cur.execute("CREATE TABLE all_word_counts (match_id,"+str(",".join(match_columns_allword))+")")
但在此之后,出现了一个错误

OperationalError: near "to": syntax error
我试着想办法,但都失败了。特别是,使用参数化SQL也得到了同样的结果

table_var = "CREATE TABLE IF NOT EXISTS match_columns_allword (?{1})"
table_var = table_var.format(",".join(match_columns_allword), ",?"* (len(match_columns_allword)))
cur.execute(table_var, [match_columns_allword])
OperationalError: near "to": syntax error

我不知道发生了什么,什么是问题,因为这两个代码总是按预期工作。请有人帮帮我……

我真的很感谢马斯特。我的问题解决了。但我不熟悉注释系统,所以注释中的代码看起来很奇怪。这是一个新的

cur.execute('''CREATE TABLE match_columns_allword ("match_id","'''+str('''","'''.join(match_columns_allword))+'''")''')

这是我在stack overflow上的第一个问题,我真的很感谢你。

你有没有试着在列表中的单词周围加上
[“hggggg”、“wtf”、“gg”、“lmao”、“hahah”
等。是的。实际上列表中的每个单词都有一个引号。现在我做了另一个列表,并把注释之后,我尝试了另一种方法。“cur.execute”(“CREATE TABLE match_columns_allword”(“match_id”)、“''+str”(“match_id”)、“'.join(match_columns_allword”)+“这使每个单词都有”最后它成功了!我真的很感激它!哦,你的代码可能有更多的问题,但它确实有帮助。