Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #52788

Re: make elements of a list twice or more.

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> (permalink)
From Tobiah <toby@tobiah.org>
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 <mailman.318.1375893821.1251.python-list@python.org>
In-Reply-To <mailman.318.1375893821.1251.python-list@python.org>
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

Show key headers only | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

make elements of a list twice or more. liuerfire Wang <liuerfire@gmail.com> - 2013-08-07 16:50 +0800
  Re: make elements of a list twice or more. alex23 <wuwei23@gmail.com> - 2013-08-20 13:42 +1000
  Re: make elements of a list twice or more. Tobiah <toby@tobiah.org> - 2013-08-21 13:01 -0700

csiph-web