MySQLDB - generating "...not in (1,2,3)" from Python list ?

Steve Zatz slzatz at
Mon Feb 23 19:20:27 CET 2004

Don't you just want:

cursor.execute("select * from T where C1 not in (%s,%s,%s)",params)

The DBAPI should be fine with params being a python list of integers
(as long as there are three of them).

More information about the Python-list mailing list