I have a set of row dictionaries each has the same keys. I want to create a pointer using a subset of the keys,
mydict = {'g':'1','a':'2','r':'3','c':'24','b':'38'}
The pointer might use the values of 'a','g' and 'c'
pointer = '-'.join([mydict['a'],mydict['g'],mydict['c']])
So the pointer looks like:
2-1-24
Is there a more general approach to accomplish the pulling of values from a dictionary in a particular order
As I am writing this I wonder if it should be on code review as I can clearly accomplish my objective but this code is not very reusable I would like to do something more 'Pythonic'
I did find this question but I don't think it is exactly what I am looking for