class Cmd:
# def __init__(self,name):
# self.name = name
def run(self):
while 1:
cmd = input('>>清输入命令>>').strip()
if hasattr(self,cmd):
func = getattr(self,cmd)
func()
def ls(self):
print('ls--->func')
def pwd(self):
print('pwd--->func')
def cat(self):
print('cat--->func')
cmd = Cmd()
cmd.run()

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-06
  • 2021-09-20
  • 2021-08-05
  • 2021-06-20
  • 2022-02-16
  • 2022-02-20
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-02
  • 2021-07-01
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案