The R function rep() replicates each element of a vector:
> rep(c(\"A\",\"B\"), times=2) [1] \"A\" \"B\" \"A\" \"B\"
This is like the list m
Use numpy arrays and the numpy.repeat function:
numpy
import numpy as np x = np.array(["A", "B"]) print np.repeat(x, [2, 3], axis=0) ['A' 'A' 'B' 'B' 'B']