Can I load a python program at the interactive >>> prompt?
mail at timgolden.me.uk
Fri Dec 5 22:05:07 CET 2008
> I am running cygwin on xp.
> Much to my annoyance, I can not cut-and-paste from a windows app to
> the python prompt. I think I could do this with putty, but I do not
> have the permissions to install putty on my xp box.
I do this all the time. The key (altho' not strictly essential)
is to access the console window Properties from the top-left drop-down
menu and then on the first tab, select Quick Edit. With this, you
can just right-click with the mouse and whatever you had in the
clipboard (as long as it's text) will drop into your Python
session. Whenever I'm posting code snippets here, I always
copy them from the email and do what I've described to run
them in a fresh interpreter session to make sure they work.
> Can I load a file into the python interactive environment? For
> example I have a file called test.py that consists of the following:
> print "hello"
> print "hello again"
> Can I load that file into python at the >>> prompt?
>>>> load "test.py"
> or something like that?
Well, you can use execfile if you want.
More information about the Python-list