1 #!/usr/bin/env python2.6
2 # coding: utf-8
3 import cmd
4
5 class HelloWorld(cmd.Cmd):
6 def init(self):
7 cmd.Cmd.init(self)
8 self.prompt = " >> "
9
10 def do_hello(self, line):
11 print ("hello")
12
13 def help_hello(self):
14 print ("hellp hello")
15
16 def do_EOF(self, line):
17 return True
18
19
20 if __name__ == '__main__':
21 HelloWorld().cmdloop()
python cmd 模块使用
最新推荐文章于 2024-07-30 11:02:18 发布