I have a list:
list
L = [\'a\', \'b\']
I need to create a new list by concatenating an original list which ra
You can use a list comprehension:
L = ['a', 'b'] k = 4 L1 = ['{}{}'.format(x, y) for y in range(1, k+1) for x in L] print(L1)
Output
['a1', 'b1', 'a2', 'b2', 'a3', 'b3', 'a4', 'b4']