Path: csiph.com!usenet.pasdenom.info!news.albasani.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!news.tele.dk!news.tele.dk!small.news.tele.dk!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.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'subject:form': 0.07; 'feature.': 0.09; 'subject:number': 0.09; 'subject:string': 0.09; 'python': 0.11; 'chris,': 0.16; 'expects': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'loop.': 0.16; 'loops': 0.16; 'ravi': 0.16; 'wrote:': 0.18; 'to:name:python-list@python.org': 0.22; 'error': 0.23; 'skip:% 10': 0.24; 'least': 0.26; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'am,': 0.29; 'dec': 0.30; 'subject:list': 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'reply.': 0.31; 'post.': 0.31; 'guess': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'done': 0.36; 'thanks': 0.36; 'skip:[ 10': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'hope': 0.61; 'simple': 0.61; 'forward': 0.65; 'subject:needed.': 0.91; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=9Gr1WvRzes6QeaGxkEHFrsgCZm3btjL7/PXikdBCKyE=; b=fOL1Q27lNG5VXs3cIxsWGINiXLqtVp+kIcHCs85eqqd3yyHnjDRkpDMe60pwZh4/KU w6dUUm6S3O00rThz/K6GPVoGuRRPzatTXfl3TBvOlXDwV1zmXvCQgHEoYvEDLeCur7OU A6Lmjbx74RZTjHXNEGVBH2UEv4TDDSYn+WM9GtCa/NrngVVZsiLMaOKmgE8y+RFGBbUY jbK5WQMPKtlskjh+qXNJtuNc347ovcaOyHwMpw1uLsU0iAwS1ClvsuivQGYWmagWrCLC HfB2ewlpx3wItRahejfb3OUEJX7J10Ee1X2AXTPDPOMlldHjMPBHU0WibuN6pWqyboOS PkJA== MIME-Version: 1.0 X-Received: by 10.68.108.194 with SMTP id hm2mr22036375pbb.22.1387216281900; Mon, 16 Dec 2013 09:51:21 -0800 (PST) In-Reply-To: <6112663707411483025@unknownmsgid> References: <2333bfb4-cd72-4ed0-9b28-d8dbe26b5be2@googlegroups.com> <6112663707411483025@unknownmsgid> Date: Tue, 17 Dec 2013 04:51:21 +1100 Subject: Re: Concatenate string list to number list to form title - Logic needed. From: Chris Angelico To: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1387216286 news.xs4all.nl 2941 [2001:888:2000:d::a6]:54286 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:62084 On Tue, Dec 17, 2013 at 4:41 AM, Ravi Prabakaran wrote: >> Hi Chris, > > Thanks for reply. If you have any good idea with loop, please post. But > i'm looking same without loop because python has slicing,concatenating and > other straight forward feature. I guess it can be done without loop. My > client does not prefer loops and expects simple and neat code to improve > performance. We are dealing with billion data. I'm going to hope that it was in error that you sent this off-list, or at least that you won't mind my replying on-list. Here's one way to do it: t = ['Start','End'] a = [[1,2,3,4], [5,6,7,8]] result = [] for cur in a: result.append("%s - %d"%(t[0],cur[2])) result.append("%s - %d"%(t[1],cur[3])) ChrisA