How to concatenate element-wise two lists in Python?

后端 未结 8 2515
春和景丽
春和景丽 2020-11-29 02:24

I have two lists and I want to concatenate them element-wise. One of the list is subjected to string-formatting before concatenation.

For example :

         


        
8条回答
  •  南笙
    南笙 (楼主)
    2020-11-29 02:52

    not using zip. I dunno, I think this is the obvious way to do it. Maybe I just learnt C first :)

    c=[]
    for i in xrange(len(a)):
        c.append("%s%02d" % (b[i],a[i]))
    

提交回复
热议问题