L
liuerfire Wang
Sorry for the title which didn't make clear.
Here is a list x = [b, a, c] (a, b, c are elements of x. Each of them are
different type). Now I wanna generate a new list as [b, b, a, a, c, c].
I know we can do like that:
tmp = []
for i in x:
tmp.append(i)
tmp.append(i)
However, I wander is there a more beautiful way to do it, like [i for i in
x]?
Thanks.
--
Best regards.
/**********************************
google+: +liuerfire <http://gplus.to/onepiece> twitter:
@liuerfire<https://twitter.com/#!/liuerfire>
µ°ÌÛ²»µ°Ì۵Ķ¼¿ÉÒÔÊÔ×ŵãÒ»ÏÂ~^_^~ <http://db.tt/YGEdRM0>
***********************************/
Here is a list x = [b, a, c] (a, b, c are elements of x. Each of them are
different type). Now I wanna generate a new list as [b, b, a, a, c, c].
I know we can do like that:
tmp = []
for i in x:
tmp.append(i)
tmp.append(i)
However, I wander is there a more beautiful way to do it, like [i for i in
x]?
Thanks.
--
Best regards.
/**********************************
google+: +liuerfire <http://gplus.to/onepiece> twitter:
@liuerfire<https://twitter.com/#!/liuerfire>
µ°ÌÛ²»µ°Ì۵Ķ¼¿ÉÒÔÊÔ×ŵãÒ»ÏÂ~^_^~ <http://db.tt/YGEdRM0>
***********************************/