[Tutor] DB qurey Problem

Dick Kniep D.J.Kniep@chello.nl
Thu May 8 17:44:12 2003


You get a tuple back with ONE element. in that case the comma is only
there to tell Python that it is a tuple. You won't get any trouble from
it.

Kind regards,
Dick Kniep

On Wed, 2003-05-07 at 18:33, Rick Pasotto wrote:
> On Wed, May 07, 2003 at 12:27:48PM -0400, Daniel Nash wrote:
> > 
> > I have a DB with email addresses in it
> > 
> > when I do the following qurey:
> > 
> > EmailList = db.query("SELECT distinct email FROM users").getresult()
> > 
> > I get a list like this : [('dan.nash@company.com',), 
> > ('fred.smit@company.com',)]
> > 
> > I want to return this list without the extra comma in each element in the 
> > list. Can I do this, if so how? Or am I going to have to get rid of it 
> > another way?
> 
> EmailList[0][0] does not have a comma in it.
> EmailList[1][0] does not have a comma in it.
> 
> -- 
> "A moral code impossible to practice, a code that demands imperfection
> or death, has taught you to dissolve all ideas in fog, to permit no
> firm definitions, to regard any concept as approximate & any rule of
> conduct as elastic, to hedge on any principle, to compromise on any
> value, to take the middle of any road." -- Ayn Rand
>     Rick Pasotto    rick@niof.net    http://www.niof.net
> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor