Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #79335
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.011 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'that?': 0.05; 'list?': 0.07; '[1,': 0.09; "'a',": 0.16; "'b',": 0.16; '()))': 0.16; '(2,': 0.16; '(3,': 0.16; '>>on': 0.16; 'merged': 0.16; 'tuples,': 0.16; 'elements': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'command': 0.22; '>>>': 0.22; 'this?': 0.23; 'mon,': 0.24; 'header:In-Reply- To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; "skip:' 10": 0.31; 'that.': 0.31; 'tuples': 0.31; 'something': 0.35; 'subject:lists': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'skip:> 10': 0.36; 'so,': 0.37; 'turn': 0.37; 'list': 0.37; 'list.': 0.37; 'lists.': 0.38; 'skip:[ 10': 0.38; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'ian': 0.60; 'skip:t 30': 0.61; 'zip': 0.64; '20,': 0.68; 'want:': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=ZX7ffvd8SypgbeO9c2hTNmbaplvRDD+iyYv+RNH4OUg=; b=Qwujp0QPMbRcoqM9S9ZKe0Hwy03c9DJ8bgjLxKCQh+3q4Tr9o6AKa12ZW5vk3+x3Dp H7BwsB1OWb54K2h9XdPbDaab6dDXODbM0wYgEPSm6QR3Bcl08+joycpXjJVd7ry1IE3K qbQDvOzNP9/UerMDRlYS2MiWhZG19jb2x8yMPJuvPx+WtWPjHelExMSCoYcHapZ+dTlr LjsMdq2EpIE4eg611reRLdpZZhC8ZvoZ35IU+P2y1Tg2BX///JvIK1zavEnJk7FQqP+D HAbod7hkQeLciVGW7QkogCRpSlvKL2KI4NHoFLLQxEon0o4Ylwxt5e8WMHmpOZT01yCU aZxg== |
| X-Received | by 10.70.17.129 with SMTP id o1mr30297158pdd.10.1413837959585; Mon, 20 Oct 2014 13:45:59 -0700 (PDT) |
| MIME-Version | 1.0 |
| In-Reply-To | <g9ra4adb83v03vjarh5vlhgpff0mhkilt7@4ax.com> |
| References | <obja4a5ij57rtuaivtvcuqsufhuhk3a2su@4ax.com> <mailman.15001.1413834029.18130.python-list@python.org> <6jpa4ahhc8ln7hk8s0258hvqd3io51epa0@4ax.com> <mailman.15005.1413835170.18130.python-list@python.org> <g9ra4adb83v03vjarh5vlhgpff0mhkilt7@4ax.com> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Mon, 20 Oct 2014 14:45:19 -0600 |
| Subject | Re: Building lists |
| To | Python <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.15007.1413837963.18130.python-list@python.org> (permalink) |
| Lines | 39 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1413837963 news.xs4all.nl 2836 [2001:888:2000:d::a6]:50325 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:79335 |
Show key headers only | View raw
On Mon, Oct 20, 2014 at 2:23 PM, Seymore4Head
<Seymore4Head@hotmail.invalid> wrote:
> On Mon, 20 Oct 2014 13:58:46 -0600, Ian Kelly <ian.g.kelly@gmail.com>
> wrote:
>
>>On Mon, Oct 20, 2014 at 1:49 PM, Seymore4Head
>><Seymore4Head@hotmail.invalid> wrote:
>>> For starters I would like to know if you can make a single item list
>>> and then turn it into a 2 item list. Is there a command for that?
>>
>>You mean like this?
>>
>>>>> the_list = ['first_item']
>>>>> the_list.append('second_item')
>>>>> the_list
>>['first_item', 'second_item']
>
>
> a=(1,2,3)
> b=("Red", "Green", "Blue")
> c=("a"."b,"c")
>
> d=(1,red,a 2,green,b 3,blue,c)
>
> Something like that.
Those are tuples, not lists. Are you trying to create a list of tuples
from a, b, and c? If so, then zip does what you want:
>>> d = list(zip(a, b, c))
>>> d
[(1, 'Red', 'a'), (2, 'Green', 'b'), (3, 'Blue', 'c')]
Or do you want all those elements merged into a single list?
>>> d = list(sum(zip(a, b, c), ()))
>>> d
[1, 'Red', 'a', 2, 'Green', 'b', 3, 'Blue', 'c']
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Building lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-20 14:10 -0400
Re: Building lists sohcahtoa82@gmail.com - 2014-10-20 11:18 -0700
Re: Building lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-20 14:21 -0400
Re: Building lists sohcahtoa82@gmail.com - 2014-10-20 11:33 -0700
Re: Building lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-20 20:55 +0100
Re: Building lists MRAB <python@mrabarnett.plus.com> - 2014-10-20 20:40 +0100
Re: Building lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-20 15:49 -0400
Re: Building lists Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-20 13:58 -0600
Re: Building lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-20 16:23 -0400
Re: Building lists Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-20 14:45 -0600
Re: Building lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-20 16:55 -0400
Re: Building lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-20 21:47 +0100
Re: Building lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-20 20:57 +0100
Re: Building lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-20 16:24 -0400
Re: Building lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-20 22:40 +0000
Re: Building lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-20 18:44 -0400
Re: Building lists Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-10-21 10:55 +1100
Re: Building lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-20 20:05 -0400
Re: Building lists Larry Hudson <orgnut@yahoo.com> - 2014-10-21 00:11 -0700
Re: Building lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-21 08:54 -0400
Re: Building lists Larry Hudson <orgnut@yahoo.com> - 2014-10-21 00:40 -0700
Re: Building lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-21 08:55 -0400
Re: Building lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-20 22:30 +0000
Re: Building lists MRAB <python@mrabarnett.plus.com> - 2014-10-20 23:57 +0100
Re: Building lists John Gordon <gordon@panix.com> - 2014-10-20 20:48 +0000
Re: Building lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-20 17:25 -0400
Re: Building lists Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-20 15:34 -0600
Re: Building lists Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-20 21:31 -0400
Re: Building lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-21 08:55 -0400
Re: Building lists Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-10-21 10:54 +1300
Re: Building lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-20 17:57 -0400
Re: Building lists Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-20 21:27 -0400
csiph-web