Jorgen Bodde wrote: > All I can think of is a 'crappy' construction where I use the iterator > to see if there was something in there, but surely, there must be a > better way to know? > > >>> r = c.execute('select * from song where id = 2') > >>> notfound = True > >>> for s in r: > ... notfound = False > ... print s > >>> if notfound: > ... print 'No rows' > > I am pretty new with Python, maybe there are some properties of an > iterator / sqlite3 I am not aware of that can tell me how many rows > are there?
What about this: if not c.fetchone(): print "No rows" or print "rowcount=", len(cur.fetchall()) -- HTH, Rob -- http://mail.python.org/mailman/listinfo/python-list