mardi 27 avril 2021

Changing the structure of a function with if statement Python

There is the function a could either be in the form of client.LinearKline.LinearKline_get() or in the form of client.Kline.Kline_get(). How could I make a and b modular so that both options could work the function below does not really work.

if choice ==1:
    a= LinearKline
    b= LinearKline_get
else:
    a= Kline
    b= Kline_get

client.a.b()

Aucun commentaire:

Enregistrer un commentaire