Path: csiph.com!usenet.pasdenom.info!aioe.org!rt.uk.eu.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!news.nosignal.org!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'that?': 0.05; 'lines.': 0.07; 'nested': 0.07; 'tuple': 0.09; 'cc:addr:python-list': 0.10; 'dec': 0.15; 'googling': 0.16; 'loops': 0.16; 'suggest?': 0.16; 'mon,': 0.16; 'wrote:': 0.17; '(in': 0.18; 'written': 0.20; 'received:209.85.216.46': 0.21; 'cc:2**0': 0.23; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'url:mailman': 0.29; 'url:python': 0.32; 'could': 0.32; 'url:listinfo': 0.32; 'much.': 0.33; 'subject:List': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'received:209.85': 0.35; 'url:org': 0.36; "didn't": 0.36; 'two': 0.37; 'item': 0.37; 'received:209': 0.37; 'received:209.85.216': 0.37; 'subject:: ': 0.38; 'list,': 0.39; 'header:Received:5': 0.40; 'help': 0.40; 'url:mail': 0.40; 'group,': 0.60; 'john': 0.60; 'dear': 0.66; 'levels': 0.66; 'kindly': 0.67 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:x-gm-message-state; bh=0rz4FQ6t5LIoyIcXL2M1mC7aYAtRF6c2O0IHv3XHBWA=; b=T6/Tu5w2E96yA3X9h8IREWgjxythDuNOPVT2WZz7Ew3iekUWO7GgjCO4yw3MI9yBIr 1R9oIEIF+EIAUoAQ3ZjDpyIwOqRUwB+aS8HhtpR7owQg8j7w/EKbNake2OgXF/Hg10ob aW8r0wnJ3Ix6Fy1my+AniAzmBhIP8oEEqeX+ebXgQPPlaOMcV43wH+/vv0LcfwRyFHJB SNlucjrsOXO+HkMj9ZsM2/h/K0Yw8OpqluC8ia06E4XTnySWAwo2dmiFEApwCn1+H3dm t1/J21pdIx7BKW/iMTrLWOabzIaWpMsb5cuSvNi/XgkkOFFRxl2zCvV6EQec0Ncv+7RM wTHg== MIME-Version: 1.0 In-Reply-To: <6049bc85-6f8e-429b-a855-ecef47a9d28e@googlegroups.com> References: <6049bc85-6f8e-429b-a855-ecef47a9d28e@googlegroups.com> From: Chris Kaynor Date: Mon, 3 Dec 2012 12:10:02 -0800 Subject: Re: Conversion of List of Tuples To: subhabangalore@gmail.com Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQk8GDELqwUga3IdAR+IPuU76mhbYshzMTkPtKQ8UFWKWFzlf9je0hsDXE4y5I8E9Q3KC2gS Cc: "python-list@python.org" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1354565427 news.xs4all.nl 6927 [2001:888:2000:d::a6]:39029 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:34186 On Mon, Dec 3, 2012 at 11:58 AM, wrote: > Dear Group, > > I have a tuple of list as, > > tup_list=[(1,2), (3,4)] > Now if I want to covert as a simple list, > > list=[1,2,3,4] > > how may I do that? > > If any one can kindly suggest? Googling didn't help much. If you know they are always exactly two levels deep, you can use nested loops (in comprehension form): [item for tuple_ in list_ for item in tuple_] That could also be written how John recommended, in three lines. > > Regards, > Subhabrata. > -- > http://mail.python.org/mailman/listinfo/python-list