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


Groups > comp.lang.python > #10976

how to separate a list into two lists?

Date 2011-08-07 01:07 +0800
Subject how to separate a list into two lists?
From smith jack <thinke365@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.1983.1312650424.1164.python-list@python.org> (permalink)

Show all headers | View raw


if a list L is composed with tuple consists of two elements, that is
L = [(a1, b1), (a2, b2) ... (an, bn)]

is there any simple way to divide this list into two separate lists , such that
L1 = [a1, a2... an]
L2=[b1,b2 ... bn]

i do not want to use loop, any methods to make this done?

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


Thread

how to separate a list into two lists? smith jack <thinke365@gmail.com> - 2011-08-07 01:07 +0800
  Re: how to separate a list into two lists? bud <only@fleshwound.org> - 2011-08-06 18:13 +0000
    Re: how to separate a list into two lists? Gelonida N <gelonida@gmail.com> - 2011-08-06 22:00 +0200
      Re: how to separate a list into two lists? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-08-07 10:07 +1000
        Re: how to separate a list into two lists? Gelonida N <gelonida@gmail.com> - 2011-08-07 19:11 +0200
  Re: how to separate a list into two lists? Tim Roberts <timr@probo.com> - 2011-08-06 17:58 -0700
    Re: how to separate a list into two lists? Chris Angelico <rosuav@gmail.com> - 2011-08-07 02:05 +0100
      Re: how to separate a list into two lists? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-08-07 11:35 +1000
  Re: how to separate a list into two lists? Paul Rubin <no.email@nospam.invalid> - 2011-08-06 22:29 -0700

csiph-web