Skip to content

Instantly share code, notes, and snippets.

@weiaicunzai
Created December 11, 2018 04:53
Show Gist options
  • Save weiaicunzai/0173c770d1404e1dc46d60c98520aa4b to your computer and use it in GitHub Desktop.
Save weiaicunzai/0173c770d1404e1dc46d60c98520aa4b to your computer and use it in GitHub Desktop.
iterate list every two elements
for x, y in zip(*[iter(line1)] * 2):
#line1(x0,y0,x1,y1)
#line1 -> (x0, y0), (x1, y1)
#. zip(*[iter(line1)] * 2)
#->zip(<tuple_iterator object at 0x10dafdb00>, <tuple_iterator object at 0x10dafdb00>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment