KP <kai.pet...@gmail.com> 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