问题
I really dont think what I'm asking for is difficult but I can't find anything that helps without it talking about integers or different kind of arguments. I just want to call different functions using argparse. I want to call either the SHC updater, HCM, or Cloud. Right now it does all 3.
I need if statements.
if __name__ == "__main__":
def _msg(updated):
return "was updated" if updated else "already up-to-date"
HCM_Updater = HCM()
updated = HCM_Updater.update()
print("HCM {}.\n".format(_msg(updated)))
SHC_Updater = SHC()
updated = SHC_Updater.update()
print("SHC {}.\n".format(_msg(updated)))
Cloud_Updater = Cloud()
updated = Cloud_Updater.update()
print("Cloud {}.\n".format(_msg(updated)))
来源:https://stackoverflow.com/questions/60820952/if-statements-that-will-call-different-functions-with-argparse