On 18/09/2013 20:28, stephen.bou...@gmail.com wrote:
Thanks to everyone for their help. Using everyone's suggestions, this seems to 
work:

import win32clipboard, win32con

def getclipboard():
     win32clipboard.OpenClipboard()
     s = win32clipboard.GetClipboardData(win32con.CF_UNICODETEXT)
     win32clipboard.CloseClipboard()
     if '\0' in s:
         s = s[:s.index('\0')]
     return s

That'll look for a null character and, if it finds one, then look for
it again. Of course, that probably isn't an issue in practice.

However, an alternative way of doing it is to use the .partition method:

     return s.partition('\0')[0]

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to