Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #100837
| From | Paul Rubin <no.email@nospam.invalid> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Is there an idiom for this? |
| Date | 2015-12-24 14:15 -0800 |
| Organization | A noiseless patient Spider |
| Message-ID | <878u4jh4sa.fsf@nightsong.com> (permalink) |
| References | <08289d1a-a032-490f-963f-cc40ec0d81e3@googlegroups.com> |
KP <kai.peters@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.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Is there an idiom for this? KP <kai.peters@gmail.com> - 2015-12-24 14:11 -0800
Re: Is there an idiom for this? Paul Rubin <no.email@nospam.invalid> - 2015-12-24 14:15 -0800
Re: Is there an idiom for this? KP <kai.peters@gmail.com> - 2015-12-24 14:32 -0800
Re: Is there an idiom for this? Quivis <quivis@domain.invalid> - 2015-12-28 19:10 +0000
csiph-web