How to add a current string into an already existing list

Steven D'Aprano steve+comp.lang.python at pearwood.info
Tue Nov 5 12:49:43 CET 2013


On Tue, 05 Nov 2013 12:33:49 +0200, Nick the Gr33k wrote:

> Στις 5/11/2013 12:20 μμ, ο/η Antoon Pardon έγραψε:
> 
>> Did you read the documentation of fetchone?
> 
> 
> 
> fetchone is like fetchall except from the fact that the former returned
> a row of data while the latter returned a list of rows of data.

Read the documentation of fetchone again:

http://docs.python.org/3/library/sqlite3.html#sqlite3.Cursor.fetchone

Take careful note of what it does when there is no more data to fetch.



> I dont know why it copmains about:
> TypeError: 'NoneType' object is not iterable
> 
> what object is supposed to have benn of None type? how do i check for
> it?

Does the name "NoneType" give you a hint? Repeat after me:

"The type of **** is NoneType."

Take a guess what the **** should be. Then test it, in the interactive 
interpreter:

type(****)  # replace the stars with the object


and see what is printed.



-- 
Steven



More information about the Python-list mailing list