[Tutor] Searching string value in db

Doug.Shawhan@gecits.ge.com Doug.Shawhan@gecits.ge.com
Wed Nov 27 14:34:02 2002


I have a database in the following format:

'key' : 'FOO, data, data' <--Regular old string with commas...

however: 

>>> for each in db.keys():
	if string.find(db[each], 'FOO') != -1:
		print each, db[each]

returns empty. 

The string manual says:
--------------------------------------
find(s, sub[, start[,end]]) 
Return the lowest index in s where the substring sub is found such that sub
is wholly contained in s[start:end]. Return -1 on failure. Defaults for
start and end and interpretation of negative values is the same as for
slices. 
-------------------------------------
I have tried many other ways to make it work with no joy. Do I have to
specify the start and finish or is there a better way that I am overlooking?

Thanks folks!

d