how to develop code using a mix of an existing python-program and console-commands

Mark Lawrence breamoreboy at yahoo.co.uk
Thu Dec 19 02:33:35 EST 2013


On 19/12/2013 07:24, Christian Gollwitzer wrote:
> Am 18.12.13 21:17, schrieb Jean Dubois:
>> I have a python-program which I want to perform its task first, then
>> switch to
>> the python console to experiment with further commands, using what was
>> already
>> defined in the python-program.
>
> Excellent way to use/debug a scripting langugage. Use ipython, and then
> either
>
> %run myfile.py
>
> or
>
> execfile('myfile.py')
>
> You can do this multiple times, where the new definitions overwrite the
> old ones. In any case, ipython is much more friendly to use at the
> command prompt than plain python.
>
>      Christian
>

execfile is Python 2 only.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence




More information about the Python-list mailing list