>>> If you understand what zip does, it should be obvious.
>>
>> Nobody likes to be told the thing they're confused about is trivial.
>Nobody likes to be told to brush their teeth, eat their vegetables or clean
>their room. Then they grow up and learn that life is full of things that you
>do be
On Wed, Jan 18, 2012 at 6:20 PM, Steven D'Aprano
wrote:
> On Wed, 18 Jan 2012 11:20:00 -0500, Devin Jeanpierre wrote:
> Nobody likes to be told to brush their teeth, eat their vegetables or
> clean their room. Then they grow up and learn that life is full of things
> that you do because you have t
On Wed, 18 Jan 2012 11:20:00 -0500, Devin Jeanpierre wrote:
> On Wed, Jan 18, 2012 at 10:27 AM, Steven D'Aprano
> wrote:
>>> That zip (*sorted...
>>>
>>> does the unzipping.
>>>
>>> But it's less than intuitively obvious.
>>
>> *shrug*
>>
>> If you understand what zip does, it should be obvious.
Neal Becker writes:
> python has builtin zip, but not unzip
>
> A bit of googling found my answer for my decorate/sort/undecorate problem:
>
> a, b = zip (*sorted ((c,d) for c,d in zip (x,y)))
>
> That zip (*sorted...
>
> does the unzipping.
>
> But it's less than intuitively obvious.
>
> I'm thi
On Wed, Jan 18, 2012 at 10:27 AM, Steven D'Aprano
wrote:
>> That zip (*sorted...
>>
>> does the unzipping.
>>
>> But it's less than intuitively obvious.
>
> *shrug*
>
> If you understand what zip does, it should be obvious.
Nobody likes to be told the thing they're confused about is trivial.
It's
On Wed, Jan 18, 2012 at 10:31 AM, Rodrick Brown wrote:
> Alec can you explain this behavior zip(*zipped)?
Here's one way to think about it: If A is a matrix, zip(*A) returns
the transpose of A. That is, the columns become rows, and the rows
become columns.
If you swap rows and columns, and then
On Wed, Jan 18, 2012 at 7:31 AM, Rodrick Brown wrote:
> On Wed, Jan 18, 2012 at 10:27 AM, Alec Taylor
> wrote:
>>
>> http://docs.python.org/library/functions.html
>> >>> x = [1, 2, 3]
>> >>> y = [4, 5, 6]
>> >>> zipped = zip(x, y)
>> >>> zipped
>> [(1, 4), (2, 5), (3, 6)]
>> >>> x2, y2 = zip(*zip
On Wed, Jan 18, 2012 at 10:31 AM, Rodrick Brown wrote:
>
>
> On Wed, Jan 18, 2012 at 10:27 AM, Alec Taylor
> wrote:
>>
>> http://docs.python.org/library/functions.html
>> >>> x = [1, 2, 3]
>> >>> y = [4, 5, 6]
>> >>> zipped = zip(x, y)
>> >>> zipped
>> [(1, 4), (2, 5), (3, 6)]
>> >>> x2, y2 = zip
On Wed, 18 Jan 2012 09:33:34 -0500, Neal Becker wrote:
> python has builtin zip, but not unzip
That's because zip is (almost) its own inverse.
> A bit of googling found my answer for my decorate/sort/undecorate
> problem:
> a, b = zip (*sorted ((c,d) for c,d in zip (x,y)))
That does a lot of
On Wed, Jan 18, 2012 at 10:27 AM, Alec Taylor wrote:
> http://docs.python.org/library/functions.html
> >>> x = [1, 2, 3]
> >>> y = [4, 5, 6]
> >>> zipped = zip(x, y)
> >>> zipped
> [(1, 4), (2, 5), (3, 6)]
> >>> x2, y2 = zip(*zipped)
> >>> x == list(x2) and y == list(y2)
> True
>
Alec can you exp
http://docs.python.org/library/functions.html
>>> x = [1, 2, 3]
>>> y = [4, 5, 6]
>>> zipped = zip(x, y)
>>> zipped
[(1, 4), (2, 5), (3, 6)]
>>> x2, y2 = zip(*zipped)
>>> x == list(x2) and y == list(y2)
True
--
http://mail.python.org/mailman/listinfo/python-list
http://docs.python.org/library/zipfile.html
ZipFile.extractall([path[, members[, pwd]]])
--
http://mail.python.org/mailman/listinfo/python-list
12 matches
Mail list logo