Assuming connectionDetails
is a Python dictionary, what's the best, most elegant, most "pythonic" way of refactoring code like this?
if "host" in connectionDetails:
host = connectionDetails["host"]
else:
host = someDefaultValue
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…