I would like to get
I know it is easy to get
['r'+str(k) for k in A]
How could I get B by one line loop as I showed above?
Use a nested list comprehension:
A=[1,2,3] B = [prefix + str(a) for a in A for prefix in 'rt']