Advertisement
Guest User

Untitled

a guest
May 22nd, 2015
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 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. # Disable rawinput module use
  18. use_rawinput = False
  19.  
  20. # Do not show a prompt after each command read
  21. prompt = ''
  22.  
  23. def do_greet(self, line):
  24. print "hello,", line
  25.  
  26. def do_EOF(self, line):
  27. return True
  28.  
  29. if __name__ == '__main__':
  30. import sys
  31. with open(sys.argv[1], 'rt') as input:
  32. HelloWorld(stdin=input).cmdloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement