[Python-FIT][Python] Python の cmd パッケージがマイナーで不遇
コンソールの対話型アプリケーションを作るのが面倒って意見が Python-FIT であがったので書いておきます。
#!/usr/bin/env python import cmd, sys class MyCmd(cmd.Cmd): def __init__(self): cmd.Cmd.__init__(self) self.prompt = 'My Prompt: ' def help_hello(self): print 'say hello' def do_hello(self, hoge): print 'Hello, world %s san' % hoge def help_EOF(self): print 'Quit the program' def do_EOF(self, line): sys.exit() if __name__ == '__main__': p = MyCmd() p.cmdloop()