On 13/09/2013 01:58, stephen.bou...@gmail.com wrote:
Hi Steven. Here is my code:

import win32clipboard, win32con

def getclipboard():
     win32clipboard.OpenClipboard()
     s = win32clipboard.GetClipboardData(win32con.CF_TEXT)
     win32clipboard.CloseClipboard()
     return s

I use this helper function to grab the text on the clipboard and do useful 
things with it.

Sorry about the description; I have stuff to learn about strings and python 3.3.

To get the string length, I just do len(s). There were 10 columns and 700+ rows 
of data, so len(s) returned 80684 from an excel spreadsheet saved as a text 
file.

From the clipboard contents copied from the spreadsheet, the characters s[:80684] were 
the visible cell contents, and s[80684:] all started with "b'\x0" and lack any 
useful info for what I'm trying to accomplish.

From my own experiments (although not with Excel) it appears that
GetClipboardData returns bytes (a bytestring), not (Unicode) strings.
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to