Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #86240
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.04; 'lawrence': 0.09; 'measure': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'strings.': 0.09; 'language.': 0.14; '-tkc': 0.16; 'concatenate': 0.16; 'iterable': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:values': 0.16; 'language': 0.16; 'wrote:': 0.18; 'variable': 0.18; 'header:User-Agent:1': 0.23; 'string,': 0.24; 'skip:" 30': 0.26; 'skip:" 20': 0.27; 'values': 0.27; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'thus': 0.29; 'tim': 0.29; 'subject:list': 0.30; 'work.': 0.31; 'chase': 0.31; 'volunteers': 0.31; 'lists': 0.32; "can't": 0.35; 'except': 0.35; 'there': 0.35; 'should': 0.36; 'list': 0.37; 'list.': 0.37; 'lists.': 0.38; 'to:addr:python-list': 0.38; 'rather': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'length': 0.61; 'entire': 0.61; "you're": 0.61; 'first': 0.61; 'our': 0.64; 'more': 0.64; 'taking': 0.65; 'charset:windows-1252': 0.65; 'presumably': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
| Subject | Re: Concatenate list values |
| Date | Mon, 23 Feb 2015 17:13:54 +0000 |
| References | <12821378-62af-4954-8b61-aa0738c5ff5c@googlegroups.com> <20150223101434.52871fcc@bigbox.christie.dr> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | host-92-24-222-48.ppp.as43234.net |
| User-Agent | Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 |
| In-Reply-To | <20150223101434.52871fcc@bigbox.christie.dr> |
| 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.19084.1424711656.18130.python-list@python.org> (permalink) |
| Lines | 33 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1424711656 news.xs4all.nl 2895 [2001:888:2000:d::a6]:45544 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:86240 |
Show key headers only | View raw
On 23/02/2015 16:14, Tim Chase wrote: > On 2015-02-23 07:58, loial wrote: >> Is there a quick way to concatenate all the values in a list into a >> string, except the first value? >> >> I want this to work with variable length lists. >> >> All values in list will be strings. > > Using > > "".join(my_list[1:]) > > should work. > > If it is an arbitrary iterable instead of a list (and thus can't be > sliced), you can use > > "".join(itertools.islice(my_iter, 1, None)) > > -tkc > Presumably rather more efficient for long lists as you're not taking a copy of (effectively) the entire list. Any volunteers to measure it, not mentioning any names, Mr D'Aprano? :) -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Concatenate list values loial <jldunn2000@gmail.com> - 2015-02-23 07:58 -0800
Re: Concatenate list values John Gordon <gordon@panix.com> - 2015-02-23 16:07 +0000
Re: Concatenate list values alister <alister.nospam.ware@ntlworld.com> - 2015-02-23 16:08 +0000
Re: Concatenate list values Peter Otten <__peter__@web.de> - 2015-02-23 17:09 +0100
Re: Concatenate list values Tim Chase <python.list@tim.thechases.com> - 2015-02-23 10:14 -0600
Re: Concatenate list values Andrew Berg <aberg010@my.hennepintech.edu> - 2015-02-23 10:14 -0600
Re: Concatenate list values Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-02-23 17:13 +0000
Re: Concatenate list values wxjmfauth@gmail.com - 2015-02-24 02:30 -0800
Re: Concatenate list values loial <jldunn2000@gmail.com> - 2015-02-24 00:37 -0800
csiph-web