Skip to content

Instantly share code, notes, and snippets.

@vindard
Created April 26, 2019 20:01
Show Gist options
  • Save vindard/b0d903260c4728afc084a1a74949a254 to your computer and use it in GitHub Desktop.
Save vindard/b0d903260c4728afc084a1a74949a254 to your computer and use it in GitHub Desktop.
Unpacking co-ords from a set of nested lists
# Sample data
img2_dims = [
[
[
'a',
'b'
],
],
[
[
'c',
'd'
],
],
[
[
'e',
'f'
],
],
[
[
'g',
'h'
],
],
]
# Co-ord assignment
(x1, y1), (x2, y2), (x3, y3), (x4, y4) = [(i[0][0], i[0][1]) for i in img2_dims]
# Print to check
print(x1, y1, '\n', x2, y2, '\n', x3, y3, '\n', x4, y4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment