Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!fx18.iad.POSTED!not-for-mail Message-ID: <52151C90.9080602@tobiah.org> From: Tobiah User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 Newsgroups: comp.lang.python Subject: Re: make elements of a list twice or more. References: In-Reply-To: Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: 7bit Lines: 9 X-Complaints-To: abuse@teranews.com NNTP-Posting-Date: Wed, 21 Aug 2013 20:01:20 UTC Organization: TeraNews.com Date: Wed, 21 Aug 2013 13:01:20 -0700 X-Received-Bytes: 1034 Xref: csiph.com comp.lang.python:52788 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