Extend multiple elements in one line iteration [duplicate]
4
This question already has an answer here:
List comprehension version of “extend” [duplicate]
1 answer
For A=[1,2,3] I would like to get B=['r1','t1','r2','t2','r3','t3'] I know it is easy to get ['r1','r2','r3'] by ['r'+str(k) for k in A] How could I get B by one line loop as I showed above? Many thanks.
python list loops iteration
share | improve this question
asked Nov 12 at 15:08
Xiaojian Chen
42 5