On Tuesday, September 9, 2014 8:08:00 AM UTC-4, Maurice Waka wrote:
>
> I have several lists in sqlite rows as follows:
>
> ROWID  x
>   1    ['123', '1234', '12345',]
>   2    ['abc', 'abcd', 'abcde',]
>   3    ['1a2b3c', '1a2b3c4d', '1a2b3c4d5e',]
>
> How are you storing the lists in a single SQLite column? Did you convert 
Python lists to strings?
 

> def types():
>     location = ""
>     conn = sqlite3.connect("types.db")
>     c = conn.cursor()
>     c.execute('select * from types ORDER by X')    
>     for rowid,X in c.execute("select rowid,X from types order by X"):
>       return row[:]
>
> Given that the identifier "row" has not been defined, the final line 
should raise an exception. Also, you don't want to return in the for loop, 
as that will terminate the function on the first pass through the loop.

Is this in a web2py app? If so, I would recommend using the DAL and store 
your lists in a list:string field. As far as looping and returning values, 
it's hard to say without more details regarding what you are trying to do. 
Are you just trying to display all the rows in an HTML page?

Anthony

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to