[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnumed-devel] curs.fetchone() ...
From: |
Karsten Hilbert |
Subject: |
Re: [Gnumed-devel] curs.fetchone() ... |
Date: |
Sun, 9 Feb 2003 13:03:48 +0100 |
User-agent: |
Mutt/1.3.22.1i |
> but you can also do
> result, = curs.fetchone()
> which delivers just the row, no a list of rows with one element only
which will fail, however, if result happens to be None ... :-(
The point being that really one needs to do:
curs.execute(select name from person where ...;)
result = curs.fetchone()
if result is None:
fail
name, = result (or name = result[0]
Unfortunately, they don't return '[None]' on None.
Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346