python dict 实现swich

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

swich = {
'hour1':pred.getper1htable,
'hour6':pred.getper6htable,
'hour12':pred.getper12htable,
'hour24':pred.getper24htable
}
data = swich[d]()
posted @ 2018-09-27 17:39  sunhuahuaa  阅读(121)  评论(0编辑  收藏  举报