Skip to content

Instantly share code, notes, and snippets.

@vitalbh
Created January 13, 2012 11:14
Show Gist options
  • Select an option

  • Save vitalbh/1605593 to your computer and use it in GitHub Desktop.

Select an option

Save vitalbh/1605593 to your computer and use it in GitHub Desktop.
busca de um valor em tuplas de tupla com python usando zip
>>> x = ((1,),(2,),(3,))
>>> list(zip(*x)[0])
[1, 2, 3]
>>> 1 in list(zip(*x)[0])
True
>>>
by @cicerocomp
>>> s = ((1,), (2,), (3,))
>>> sum(s, ())
(1, 2, 3)
>>> 2 in sum(s, ())
True
by @rafaelalmeida
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment