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.

Message-ID <52151C90.9080602@tobiah.org> (permalink)
From Tobiah <toby@tobiah.org>
Newsgroups comp.lang.python
Subject Re: make elements of a list twice or more.
References <mailman.318.1375893821.1251.python-list@python.org>
Organization TeraNews.com
Date 2013-08-21 13:01 -0700

Show all headers | 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