Thanks Paul, you just pointed out one of my blonder moments: I actually want all nested dicts one by one, but not the one with the 'c' key...
On Thursday, 24 December 2015 14:15:45 UTC-8, Paul Rubin wrote: > KP writes: > > for config in cfg: > > if config != 'c': > > print config > > > > Is there an idiom that combines the 'for...' & the 'if..' lines into one? > > Maybe you actually want > > print [config for config in cfg if config != 'c'] > > That prints all the relevant keys as a list, rather than one per line. -- https://mail.python.org/mailman/listinfo/python-list