Sebastian <sebastian.lan...@gmx.de> writes:

> Hi there,
>
> I have an array  x=[1,2,3]

In python such an object is called a "list".

(In cpython it's implemented as an automatically resizable array.)

>
> Is there an operator which I can use to get the result
> [1,1,1,2,2,2,3,3,3] ?

There's no operator that will give you that directly - but there are
plenty of one-liners that will yield that list.
e.g:

>>> list(itertools.chain(*([x]*3 for x in [1,2,3])))
[1, 1, 1, 2, 2, 2, 3, 3, 3]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to