On Mon, Mar 19, 2018 at 3:18 PM, Ben Finney <ben+pyt...@benfinney.id.au> wrote: > Chris Angelico <ros...@gmail.com> writes: > >> Sounds like a set operation to me. >> >> expected = {"foo", "bar", "spam"} >> missing = expected - set(json) > > That works (because iterating a dict returns its keys). But it is less > immediately understandable, IMO, than this:: > > expected = {"foo", "bar", "spam"} > missing = expected - set(json.keys()) >
Sure, whichever way you want to do it. Either way, it's a set difference operation that gives the OP's desired information. ChrisA -- https://mail.python.org/mailman/listinfo/python-list