how to mimic interactive

Bjorn Pettersen bjorn at roguewave.com
Fri Jul 7 13:52:33 EDT 2000


You could always do 

   exec 'print ' + raw_input(prompt)

perhaps with a test to see whether the user typed print...  You should
also take a look at the code module, and perhaps also the PyShell.py
file in Idle.

-- bjorn

Johannes Zellner wrote:
> 
> Hello,
> 
> how do I design an interactive input loop so that it
> feels like called python interactively ? (e.g. prints
> results of math operations)
> 
> e.g. in a script
> 
> while 1:
>     exec raw_input(prompt)
> 
> if I run this script and type
>     2*3
> 
> at the input prompt it does not print the result
> as in the interactive python interp.
> 
> Short: where do I find the input loop implementation
> for interactive python `shells' ?
> 
> --
>    Johannes
> 
> --
> http://www.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list