I have a large dictionary and want to filter the dictionary by values, which is in Hex.

dataDict = { ('apple':0,'orange':0):0x8000, ('apple':0,'orange':1):0x0001,('apple':0,'orange':1):0x0010 }

What I want to do is filter out the values of the dictionary according to a match. For example, one of the filters I would print out is when 0x0010 is found. I would want to print out the key and value of that match, so it would return ('apple':0,'orange':1):0x0010.

You have your values and keys reversed, looks like. It is simple to reverse a dict however if the values are unique:

data_reversed = dict((b,a) for a,b in dataDict.items())
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.