Function that returns a tuple

Marcpp marcpp at gmail.com
Sun Jun 17 05:16:05 EDT 2007


On 17 jun, 03:53, Dan Hipschman <d... at linux.ucla.edu> wrote:
> On Sat, Jun 16, 2007 at 06:30:26PM -0700, Marcpp wrote:
> > Hi, I need to returns a tuple from a function (reads a database)
> > Any idea?.
>
> Like this?
>
> def foo():
>     return 1, 2, 3, 4
Hi, I need to return a tupla like this function:

    def BDllids(a):
        a = ()
        conn = sqlite.connect('tasques.db')
        cursor =  conn.cursor()
        cursor.execute('SELECT * FROM tasques')
        for row in cursor:
            a.append (row[0])
        return a()

I'm doing the correct, method?




More information about the Python-list mailing list