Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #65113
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'nested': 0.07; '[1,': 0.09; 'iterate': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'solution,': 0.09; 'random': 0.14; '2],': 0.16; '[])': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'subject:sub': 0.16; 'succinct': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'skip:l 30': 0.24; 'least': 0.26; 'header:X-Complaints-To:1': 0.27; 'subject:list': 0.30; 'way?': 0.31; 'subject:all': 0.32; 'another': 0.32; "can't": 0.35; 'but': 0.35; 'really': 0.36; 'should': 0.36; 'two': 0.37; 'list': 0.37; 'to:addr:python-list': 0.38; 'list,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'numbers': 0.61; 'email addr:gmail.com': 0.63; 'provide': 0.64; 'them)': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Peter Otten <__peter__@web.de> |
| Subject | Re: how to iterate all sub-element in a list |
| Date | Fri, 31 Jan 2014 11:48:13 +0100 |
| Organization | None |
| References | <412b4d42-acba-4609-bd6d-e4d5c32db035@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="ISO-8859-1" |
| Content-Transfer-Encoding | 7Bit |
| X-Gmane-NNTP-Posting-Host | p50848b42.dip0.t-ipconnect.de |
| User-Agent | KNode/4.7.3 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.6202.1391165287.18130.python-list@python.org> (permalink) |
| Lines | 15 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1391165287 news.xs4all.nl 2909 [2001:888:2000:d::a6]:44810 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:65113 |
Show key headers only | View raw
seaspeak@gmail.com wrote: > a list like L = [[1, 2], [3, 4, 5], [6]], which has > random numbers of list, which has random numbers. > > How do I get another list m = [1, 2, 3, 4, 5, 6] in a succinct way? ( or > iterate them) I should provide my own solution, but I really can't come > out with one. sum(L, []) list(itertools.chain.from_iterable(L)) but as a learning experience you should do this at least once with two nested for loops, then again with a single for loop and list.extend().
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
how to iterate all sub-element in a list seaspeak@gmail.com - 2014-01-31 02:16 -0800
Re: how to iterate all sub-element in a list Skip Montanaro <skip@pobox.com> - 2014-01-31 04:29 -0600
Re: how to iterate all sub-element in a list seaspeak@gmail.com - 2014-01-31 02:42 -0800
Re: how to iterate all sub-element in a list Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-01-31 14:48 +0000
Re: how to iterate all sub-element in a list seaspeak@gmail.com - 2014-01-31 08:23 -0800
Re: how to iterate all sub-element in a list Peter Otten <__peter__@web.de> - 2014-01-31 11:48 +0100
Re: how to iterate all sub-element in a list Rustom Mody <rustompmody@gmail.com> - 2014-01-31 04:12 -0800
csiph-web