Python dynamic function names

前端 未结 8 1442
星月不相逢
星月不相逢 2020-12-29 13:54

I\'m looking for a better way to call functions based on a variable in Python vs using if/else statements like below. Each status code has a corresponding function



        
8条回答
  •  独厮守ぢ
    2020-12-29 14:03

    I encountered the same problem previously. Have a look at this question, I think its what you are looking for.

    Dictionary or If Statements

    Hope this is helpful

    Eef

提交回复
热议问题