tags:

views:

1541

answers:

2

How do I read text from the (windows) clipboard from python?

+1  A: 

Try win32clipboard from the win32all package (that's probably installed if you're on ActiveState Python).

See sample here: http://code.activestate.com/recipes/474121/

Eli Bendersky
+8  A: 

You can use the module called win32clipboard (see documentation at http://docs.activestate.com/activepython/2.5/pywin32/win32clipboard.html)

some Examples:

import win32clipboard

win32clipboard.OpenClipboard()
win32clipboard.EmptyClipboard()
data = win32clipboard.GetClipboardData()
win32clipboard.SetClipboardText(text)
win32clipboard.CloseClipboard()
Sakin