<br><div><span class="gmail_quote">2008/4/11, Evan <<a href="mailto:xdicry@gmail.com">xdicry@gmail.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br> Hope this hasn't been posted hundreds of times. I'm new for this.<br> <br> Before using python for this kind of script, I was using TCL to write<br> down a "command line based" interactive program.  it likes a "tclsh",<br>
 or "python" command, after that, you can work under a prompt,  for<br> example, " - >> ", and then you can execute any commands what you<br> defined in script.<br> <br> Now, in python, are there any common way(class) to finish this work?<br>
 or does anybody has a example to do that?</blockquote><div><br>I think the simplest way is using the InteractiveConsole class
from the 'code' module. It shows a prompt, reads the commands
you type and checks and executes them. Doc here:
<a href="http://docs.python.org/lib/module-code.html">http://docs.python.org/lib/module-code.html</a><br>This way the TCL part could be not necessary, though.<br><br>
If you need some special functionality (e.g., storing the commands you type), you can subclass it easily.<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
 Thanks,<br> Evan<br> </blockquote></div><br>

Hope it helps :)<br>