如何重复列表的每个元素n次数并形成新列表?例如:
n
x=[1,2,3,4] n=3 x1=[1,1,1,2,2,2,3,3,3,4,4,4]
x*n 不起作用
x*n
for i in x[i] x1=n*x[i]
必须有一个简单而聪明的方式.
python
python ×1