Advertisement
Guest User

Untitled

a guest
May 22nd, 2015
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # encoding: utf-8
  3. #
  4. # Copyright (c) 2008 Doug Hellmann All rights reserved.
  5. #
  6. """
  7. """
  8.  
  9. __version__ = "$Id$"
  10. #end_pymotw_header
  11.  
  12. import cmd
  13.  
  14. class HelloWorld(cmd.Cmd):
  15. """Simple command processor example."""
  16.  
  17. def do_greet(self, person):
  18. if person:
  19. print "hi,", person
  20. else:
  21. print 'hi'
  22.  
  23. def help_greet(self):
  24. print '\n'.join([ 'greet [person]',
  25. 'Greet the named person',
  26. ])
  27.  
  28. def do_EOF(self, line):
  29. return True
  30.  
  31. if __name__ == '__main__':
  32. HelloWorld().cmdloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement