如何在Python中編寫SQL查詢來選擇元素LIKE IN Python list?Python SQLite SELECT LIKE IN [list]
例如,我有一個字符串
Names=['name_1','name_2',..., 'name_n']
和SQLite_table的Python列表。
我的任務是找到最短的辦法
SELECT elements FROM SQLite_table WHERE element_name LIKE '%name_1%'
SELECT elements FROM SQLite_table WHERE element_name LIKE '%name_2%'
...
SELECT elements FROM SQLite_table WHERE element_name LIKE '%name_n%'
http://stackoverflow.com/q/15041534/2266261的副本? – Dunno
不是。問題是LIKE。 – drastega
'SELECT元素FROM SQLite_table WHERE element_name LIKE'%name_1%'或者element_name LIKE'%name_2%'或者element_name LIKE'%name_n%'''? – PostMan