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

Chris Angelico rosuav at gmail.com
Mon Dec 16 12:52:30 EST 2013


On Tue, Dec 17, 2013 at 4:51 AM, Chris Angelico <rosuav at 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



More information about the Python-list mailing list