How to concatenate element-wise two lists in Python?

后端 未结 8 2495
春和景丽
春和景丽 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:47

    Use zip:

    >>> ["{}{:02}".format(b_, a_) for a_, b_ in zip(a, b)]
    ['asp100', 'asp101', 'asp105', 'asp106', 'asp210', 'asp211']
    

提交回复
热议问题