I saw How to extract dictionary single key-value pair in variables suggesting:
d = {"a":1}
(k, v), = d.items()
But: I only care about the value. And I want to pass that value to a method; like:
foo(v)
So the question is: is there a simple command that works for both python2 and python3 that gives me that value directly, without the detour of the "tuple" assignment?
Or is there a way to make the tuple assignment work for my usecase of calling a method?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…