简单的sqlite问题

rel*_*ima 5 python sql sqlite

我用的时候:

for i in Selection:
    Q = "SELECT columnA FROM DB WHERE wbcode='"+i+"' and commodity='1'"
    cursor.execute(Q)
    ydata[i] = cursor.fetchall()
Run Code Online (Sandbox Code Playgroud)

我明白了:

ydata = {'GBR': [(u'695022',), (u'774291',), (u'791499',)... ]}
Run Code Online (Sandbox Code Playgroud)

如何更改我的代码以获取:

ydata = {'GBR': [695022, 774291, 791499,...]}
Run Code Online (Sandbox Code Playgroud)

非常感谢你.obs:这只是一个简化的例子.尽量避免提出有关sql注入的建议.

Ign*_*ams 4

[int(x[0]) for x in cursor.fetchall()]
Run Code Online (Sandbox Code Playgroud)