un-tuple (newbie)

Martin Doering doeringm at gmx.de
Mon Dec 1 05:30:20 EST 2003


Hi!


I want to use Jython to fetch exactly one value from a database query,
like here:

# execute a query
def query(db, sql):
    c = db.cursor()
    c.execute(sql)
    for line in c.fetchall():
        val = line
        print val
    c.close()
    return val


I could find out, how to create a tuple with just one member, but I
can not find out how to get a value from a tuple with just one member.

It will be an easy answer, I think. Sorry, it all is totally new for
me.  :-)

--
Martin Doering




More information about the Python-list mailing list