combining commands:

kasper37 at caffeinedreams.com kasper37 at caffeinedreams.com
Tue May 29 20:49:11 CEST 2001


> 
> def sql(sql):
>    // code to connect DB... bla..bal....
>    c.execute(sql)
>    return c.fetchall()
> 
> print sql("SELECT * FROM USER")
> 
> You can edit this for your own use.

This is probably what I will end up doing.  I thought of this after
posting...

> We'd need to know what c was to begin with, but if you're desperate for
> one line, have you tried this to see if it works?

I'm not really desperate for a one liner...just more pleasant code. 
Seeing three lines for every time I want to get the value of a db
entry didn't ring well.

Thanks for your responces.

Dan



More information about the Python-list mailing list