I have a dict that stores chunk coordinates and their content in a game I'm making. It looks like this
Is there any way I can acomplish that?
I worked it out, it actually was pretty simple:
chunks = { '0,0' : <content>, '0,1' : <content> ... }What I need is to get the keys, and turn them into coordinates, so I get a tuple like this:
'0,0' -> (0, 0)
Is there any way I can acomplish that?
I worked it out, it actually was pretty simple:
a = '1,2'.split(',') a = tuple(a) a = (int(a[0]), int(a[1])) print(a)
Output:(1, 2)