I have a dictionary:
links = { (4,32):"Link1",
(3,32):"Link2",
(2,32):"Link3",
(1,32):"Link4",
(0,32):"Link5",
(4,64):"Link6",
(3,64):"Link7",
(2,64):"Link8",
(1,64):"Link9",
(0,64):"Link10"}
I would like to access to values in this dictionary giving two element of tuple.
Something like this:
#pseudocode
x = 0
y = 64
(x,y) ---> Link10
You can just do
links[(x,y)]
Use the tuple as key to access your dictionary
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.