I have a dict:
A = {'serial1': 'x1', 'serial2': 'x2', 'serial3': 'x3', 'serial4': 'x5', 'serial5': 'x5'}```
How can I get only the value of each keys? I only want to retrieve the value and remove the key.
Expected Output:
A = {'x1', 'x2', 'x3', 'x5', 'x5'}
CodePudding user response:
B = A.values()
print(B)
>>> ['x1', 'x2', 'x3', 'x5', 'x5']
B = [item[1] for item in A.items()]
print(B)
>>> ['x1', 'x2', 'x3', 'x5', 'x5']