[Tutor] Handling 'None' (null) values when processing sqlite cursorresults

Monte Milanuk memilanuk at gmail.com
Thu Jul 15 06:55:00 CEST 2010

On 7/14/10 5:32 AM, Alan Gauld wrote:

> The key principle is do not try to store your data in a display format.

Never was my intention.  I just hadn't anticipated needing to write my 
own function to handle something as (I would think) common as a NULL 
value in a database field.

I had been working with something very simple like:

for lines in cursor.fetchall()
	title = lines[1]
	first = lines[2]
	mid = lines[3]
	last = lines[4]

	print "%s %s %s %s" % (title, first, mid, last)
	print "%s" % (street)
	print "%s, %s %s" % (city, state, zipcode)
	print "%s" % (phone)
	print "%s" % (email)

etc. etc.  for one format (supposed to look like a mailing label, more 
or less), and then I was going to experiment with other formatting later.

I'll work with the stuff you all have provided as I get time... thanks a 


More information about the Tutor mailing list