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.

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 2013-12-17 04:52 +1100
Subject Re: Concatenate string list to number list to form title - Logic needed.
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.4227.1387216355.18130.python-list@python.org> (permalink)

Show all headers | 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