SyntaxFix
Write A Post
Hire A Developer
Questions
say you have a dict with tuples as keys, e.g: labels = {(1,2,0): 'label_1'} you can modify the elements of the tuple keys as follows:
dict
labels = {(1,2,0): 'label_1'}
formatted_labels = {(elem[0],elem[1]):labels[elem] for elem in labels}
Here, we ignore the last elements.