Can python access windows clipboard

Ant antroy at
Thu Jun 21 11:23:14 CEST 2007

On Jun 21, 9:59 am, MaHL <mhl1... at> wrote:
> Can I use python to copy something(like a string) to the clipboard, so
> that I can paste it somewhere else. Is there a way to do this?

The following requires Mark Hammond's win32all package (http://

import win32clipboard, win32con, random

text = "Some text to stick on the clipboard"

win32clipboard.SetClipboardData(win32con.CF_TEXT, text)


More information about the Python-list mailing list