I have a tuple, l
, with 100 surnames. How can I do something like this in sqlite3:
l = ("Smith", "Murphy", "Owens", ...)
with sqlite3.connect("census.sqlite") as conn:
c = conn.cursor()
c.execute('select firstname, surname from census_data where surname in ?',(l,))
so that I can return all the records for the surnames contained in l
.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…