码迷,mamicode.com
首页 > 其他好文 > 详细

Test

时间:2020-01-16 10:52:23      阅读:69      评论:0      收藏:0      [点我收藏+]

标签:class   style   print   href   getattr   cut   exec   please   reg   

 

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

标签:class   style   print   href   getattr   cut   exec   please   reg   

原文地址:https://www.cnblogs.com/sara20200116/p/12199759.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!