execute file interactively
Fernando PĂ©rez
fperez528 at yahoo.com
Sun Feb 17 15:24:48 EST 2002
Jason wrote:
> When using the Python interpreter interactively, how can I execute a
> file, so I can use the function definitions and data defined in it
> interactively.
See:
http://www-hep.colorado.edu/~fperez/ipython/
The @run command does exactly what you want, including passing things that
will look to your file like command line arguments.
In regular python, you can use execfile('filename.py'). There may be
namespace issues there, and if you want to pass arguments you need to fix
sys.argv yourself.
Cheers,
f.
More information about the Python-list
mailing list