Sorry guys this works I tested with
bad values



I'm having trouble with this function i have a list with dicts and I'm trying to make a search in the list.
The problem is that my function doesn't return the list even though i know the values and types are correct

def dbsearch(db, element, val):
	for x in db:
		if x.get(element) == val:
			return x
			print "nope not in this one"

Any help or input is apreciated.

So how did you solve it?

Thats the embarrasing part. The code works fine. It was just my testing that was bad, I used a value that i thought would generate a true but afterwards i realized i should generate a false.

so the problem is the "even though i know the values and types are correct" part in your initial statement :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.