Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #62085

Re: Concatenate string list to number list to form title - Logic needed.

Path csiph.com!usenet.pasdenom.info!goblin1!goblin.stu.neva.ru!uio.no!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 <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.025
X-Spam-Evidence '*H*': 0.96; '*S*': 0.01; 'subject:form': 0.07; 'output,': 0.09; 'strings.': 0.09; 'subject:number': 0.09; 'subject:string': 0.09; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.18; 'to:name:python-list@python.org': 0.22; 'skip:% 10': 0.24; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'dec': 0.30; 'subject:list': 0.30; 'message- id:@mail.gmail.com': 0.30; "i'd": 0.34; 'received:google.com': 0.35; 'two': 0.37; 'list.': 0.37; 'skip:[ 10': 0.38; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'easier,': 0.84; '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=q2B7iYp9BJxHqipt/U1tB9Z574hHwu8h0/HSTt3cGl4=; b=cncxexLRUyRKOlYdp3d5n1RigB7CZatVKn9nsKmHKwCKKa3bbla7oZC/JCjtCQ4UYV PgpMb/DJwGIYkst5XXKoj7Be1UZQ/ScEm844jFvQW1Y8H4IkcUHAAwMni6g5kUbv70yL ivplUl0SYr3m2Rksbwgf1vAXK30be1vz6I6DmM9wh0+Lpy5Cd3/QykzFoXxgFGIC7kL5 4yAVtVmKb9ugJ+TGKI9cjpZaRU/rJYa2/Iws1bfBBtEnmwRB7bfxQj5fspJoi993M2nj XaMCyt0fbp8ZmHZ61BCG53BFttrSNuhW4eGiokcSmiUhh6tKsRbiaXxUz1z7tAjg2sVN VI3Q==
MIME-Version 1.0
X-Received by 10.66.164.136 with SMTP id yq8mr21907277pab.67.1387216350963; Mon, 16 Dec 2013 09:52:30 -0800 (PST)
In-Reply-To <CAPTjJmrfVcajy5ZPuCpyH6+DvY5P_N5njdWJA1rft-KRBM44Rw@mail.gmail.com>
References <2333bfb4-cd72-4ed0-9b28-d8dbe26b5be2@googlegroups.com> <mailman.4224.1387214986.18130.python-list@python.org> <6112663707411483025@unknownmsgid> <CAPTjJmrfVcajy5ZPuCpyH6+DvY5P_N5njdWJA1rft-KRBM44Rw@mail.gmail.com>
Date Tue, 17 Dec 2013 04:52:30 +1100
Subject Re: Concatenate string list to number list to form title - Logic needed.
From Chris Angelico <rosuav@gmail.com>
To "python-list@python.org" <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 <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.4227.1387216355.18130.python-list@python.org> (permalink)
Lines 14
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1387216355 news.xs4all.nl 2845 [2001:888:2000:d::a6]:55578
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:62085

Show key headers only | View raw


On Tue, Dec 17, 2013 at 4:51 AM, Chris Angelico <rosuav@gmail.com> wrote:
> 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]))

Whoops, I misread the desired output, I thought you wanted a
four-string list. It's two strings. That's actually easier, and Mark's
solution is pretty much what I'd go for.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Concatenate string list to number list to form title - Logic needed. Ravi Prabakaran <ravi.itm@gmail.com> - 2013-12-16 09:16 -0800
  Re: Concatenate string list to number list to form title - Logic needed. Chris Angelico <rosuav@gmail.com> - 2013-12-17 04:29 +1100
    Re: Concatenate string list to number list to form title - Logic needed. Chris Angelico <rosuav@gmail.com> - 2013-12-17 04:51 +1100
    Re: Concatenate string list to number list to form title - Logic needed. Chris Angelico <rosuav@gmail.com> - 2013-12-17 04:52 +1100
  Re: Concatenate string list to number list to form title - Logic needed. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-16 17:43 +0000
  Re: Concatenate string list to number list to form title - Logic needed. Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-12-16 20:13 +0200
    Re: Concatenate string list to number list to form title - Logic needed. Peter Otten <__peter__@web.de> - 2013-12-16 19:37 +0100
  Re: Concatenate string list to number list to form title - Logic needed. John Gordon <gordon@panix.com> - 2013-12-16 18:50 +0000
  Re: Concatenate string list to number list to form title - Logic needed. Terry Reedy <tjreedy@udel.edu> - 2013-12-16 15:23 -0500

csiph-web