Why not have python copy the text to the clipboard for you? You will need
the win32 packages, which is hardly a turnoff since they are so useful.

import win32clipboard
win32clipboard.OpenClipboard()
win32clipboard.EmptyClipboard()
win32clipboard.SetClipboardText(text)
win32clipboard.CloseClipboard()


Python puts it on the clipboard for use for you! I trump the above '5 steps'
and even '1 step' with 0 steps! I hope this helps. (Remember to close the
clipboard, I forgot when I was first trying to come up with this and it does
not work if the clipboard remains open. Thanks goes to Bob Gailer and his
2003 post for the syntax reminder)



On Tue, Jun 10, 2008 at 11:26 PM, Alan Gauld <[EMAIL PROTECTED]>
wrote:

>
> "Terry Carroll" <[EMAIL PROTECTED]> wrote
>
>  If TextPad is your default txt editor just use
>>> os.system("foo.txt")
>>>
>>
>> or os.startfile("foo.txt"); sounds like the equivalent, but for some
>> reason, I prefer it.
>>
>
> Actually os.startfile was what I meant for the default case!
> Thanks for pointing it out. system() may work if the preference is
> already set but startfile is specifically intended for that scnario.
>
> Alan G
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>



-- 
-John Chandler
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to