How to add a current string into an already existing list

Antoon Pardon antoon.pardon at rece.vub.ac.be
Tue Nov 5 13:42:19 CET 2013


Op 05-11-13 13:25, Nick the Gr33k schreef:
> 
> # fetch those columns that act as lists but are stored as strings
> cur.execute('''SELECT refs, visits, downloads FROM visitors WHERE
> counterID = %s and host = %s''', (cID, host) )
> data = cur.fetchone()
>        
> print( type(data) )
> sys.exit(0)
> 
> i tried inserting a type function to notify me of the datatype of 'data'
> but that didnt help too.
> 
> Still:
> [Tue Nov 05 14:22:32 2013] [error] [client 176.92.96.218]   File
> "/home/nikos/public_html/cgi-bin/metrites.py", line 268, in <module>
> [Tue Nov 05 14:22:32 2013] [error] [client 176.92.96.218]     (ref,
> visit, download) = data
> [Tue Nov 05 14:22:32 2013] [error] [client 176.92.96.218] TypeError:
> 'NoneType' object is not iterable
> 
> Unfortunately i still miss your point.

*Read* the documentation of fetchone! The information you need is there.

-- 
Antoon Pardon



More information about the Python-list mailing list