Test

 

this is test


class
Account: func_lic = ['login', 'logout', 'register'] def login(self): print('login successful') def logout(self): print('logout successful') def register(self): print('register successful') def run(self): print(''' please enter you want to execute method: 1. login 2. logout 3. register ''') choice = int(input('enter method code: ')) func_name = Account.func_lic[choice-1] func = getattr(Account,func_name) func(self) # func = getattr(self, func_name) # func() obj1 = Account() obj1.run()

你可能感兴趣的:(Test)