desired_ids = ['1', '2', '5', '47']
result_set = c.execute('SELECT * FROM distro WHERE id IN (%s)' % ('?,' *
    len(desired_ids))[:-1], desired_ids)
for result in result_set:
    pass
Подстановка параметров для предложения SQLite "IN"