QuoteSQL

Sybren Stuvel sybrenUSE at YOURthirdtower.com.imagination
Tue Sep 26 16:25:13 CEST 2006


Tim Chase enlightened us with:
> >>> cur.execute("select * from people where last_name in (%s)" %
> 	','.join('%s' for i in xrange(len(t))),
> 	t)

But since the value of 'i' isn't used at all, it can be abbreviated
to:

>>> cur.execute("select * from people where last_name in (%s)" %
	','.join('%s' for i in t),
	t)

Sybren
-- 
Sybren Stüvel
Stüvel IT - http://www.stuvel.eu/



More information about the Python-list mailing list