[Tutor] A demon command line interpreter using the 'cmd' module

Amit Saha amitsaha.in at gmail.com
Sun Sep 22 05:01:17 CEST 2013


I wrote this demo command line interpreter to demonstrate using the
cmd module: https://gist.github.com/amitsaha/6047955

<code>

$ python3 demo_cmd_interpreter.py
Welcome to Dummy shell. Type help or ? to list commands.


dummyshell>> help

Documented commands (type help <topic>):
========================================
exit  help  shell  whoami


dummyshell>> whoami
gene

dummyshell>> !date
Sun Sep 22 13:00:01 EST 2013



dummyshell>> quit
Bye!

</code>

To learn more about the cmd module: http://docs.python.org/3/library/cmd.html

Hope someone finds this useful in their learning/teaching.


Best,
Amit.
-- 
http://echorand.me


More information about the Tutor mailing list