Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsreader4.netcologne.de!news.netcologne.de!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.016 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'strings.': 0.09; '-tkc': 0.16; 'concatenate': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'iterable': 0.16; 'received:174.136': 0.16; 'subject:values': 0.16; 'wrote:': 0.18; 'variable': 0.18; 'string,': 0.24; 'skip:" 30': 0.26; 'skip:" 20': 0.27; 'values': 0.27; 'header:In-Reply- To:1': 0.27; 'thus': 0.29; 'subject:list': 0.30; 'work.': 0.31; "can't": 0.35; 'except': 0.35; 'there': 0.35; 'charset:us-ascii': 0.36; 'should': 0.36; 'list': 0.37; 'received:10': 0.37; 'lists.': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'length': 0.61; 'first': 0.61 X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-MC-Relay: Neutral X-MailChannels-SenderId: wwwh|x-authuser|tim@thechases.com X-MailChannels-Auth-Id: wwwh X-MC-Loop-Signature: 1424707985747:1936141862 X-MC-Ingress-Time: 1424707985747 Date: Mon, 23 Feb 2015 10:14:34 -0600 From: Tim Chase To: python-list@python.org Subject: Re: Concatenate list values In-Reply-To: <12821378-62af-4954-8b61-aa0738c5ff5c@googlegroups.com> References: <12821378-62af-4954-8b61-aa0738c5ff5c@googlegroups.com> X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AuthUser: tim@thechases.com X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1424707997 news.xs4all.nl 2971 [2001:888:2000:d::a6]:47418 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:86234 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