[Pythonmac-SIG] Copying to clipboard (pasteboard)

Martina Oefelein Martina at Oefelein.de
Tue Mar 22 22:01:48 CET 2005


Hi Jeremy:

> I have a little python script that reads a text file and prints what 
> it finds to the screen.  Not everything it finds, of course, just the 
> important stuff.  Instead of printing to the screen, or in addition to 
> printing to the screen, I would also like to copy the text to the 
> clipboard so I can paste it in another application.  Does anyone know 
> how to do this?

just pipe the output of your script into pbcopy, for example:

$ python myscript.py | pbcopy

ciao
Martina



More information about the Pythonmac-SIG mailing list