Created
April 26, 2019 20:01
-
-
Save vindard/b0d903260c4728afc084a1a74949a254 to your computer and use it in GitHub Desktop.
Unpacking co-ords from a set of nested lists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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