make elements of a list twice or more.

Tobiah toby at tobiah.org
Wed Aug 21 16:01:20 EDT 2013


On 08/07/2013 01:50 AM, liuerfire Wang wrote:
> 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].

If you don't care about the order, you can do:

	x = x + x



More information about the Python-list mailing list