Stripping characters from windows clipboard with win32clipboard from excel
stephen.boulet at gmail.com
stephen.boulet at gmail.com
Thu Sep 12 20:58:15 EDT 2013
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.
More information about the Python-list
mailing list