python dict 实现swich

使用dict实现swich,通过不同的键映射不同的函数。

swich = {
'hour1':pred.getper1htable,
'hour6':pred.getper6htable,
'hour12':pred.getper12htable,
'hour24':pred.getper24htable
}
data = swich[d]()
原文地址:https://www.cnblogs.com/sunhuahuaa/p/9714528.html