Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #54091

Re: Stripping characters from windows clipboard with win32clipboard from excel

Newsgroups comp.lang.python
Date 2013-09-12 17:58 -0700
References <13c19665-6dc9-49fe-88c8-52c643892eba@googlegroups.com>
Message-ID <74479771-2726-4a34-8fd6-531d64c5b7a5@googlegroups.com> (permalink)
Subject Re: Stripping characters from windows clipboard with win32clipboard from excel
From stephen.boulet@gmail.com

Show all headers | View raw


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.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Stripping characters from windows clipboard with win32clipboard from excel stephen.boulet@gmail.com - 2013-09-12 16:01 -0700
  Re: Stripping characters from windows clipboard with win32clipboard from excel Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-13 00:19 +0000
  Re: Stripping characters from windows clipboard with win32clipboard from excel stephen.boulet@gmail.com - 2013-09-12 17:58 -0700
    Re: Stripping characters from windows clipboard with win32clipboard from excel MRAB <python@mrabarnett.plus.com> - 2013-09-13 02:56 +0100
    Re: Stripping characters from windows clipboard with win32clipboard from excel Neil Hodgson <nhodgson@iinet.net.au> - 2013-09-13 13:43 +1000
      Re: Stripping characters from windows clipboard with win32clipboard from excel stephen.boulet@gmail.com - 2013-09-13 07:31 -0700
        Re: Stripping characters from windows clipboard with win32clipboard from excel Neil Cerutti <neilc@norwich.edu> - 2013-09-13 14:37 +0000
        Re: Stripping characters from windows clipboard with win32clipboard from excel stephen.boulet@gmail.com - 2013-09-13 07:38 -0700
          Re: Stripping characters from windows clipboard with win32clipboard from excel random832@fastmail.us - 2013-09-13 12:09 -0400
          Re: Stripping characters from windows clipboard with win32clipboard from excel random832@fastmail.us - 2013-09-18 15:19 -0400
  Re: Stripping characters from windows clipboard with win32clipboard from excel stephen.boulet@gmail.com - 2013-09-17 09:00 -0700
  Re: Stripping characters from windows clipboard with win32clipboard from excel stephen.boulet@gmail.com - 2013-09-18 12:28 -0700
    Re: Stripping characters from windows clipboard with win32clipboard from excel MRAB <python@mrabarnett.plus.com> - 2013-09-18 20:40 +0100
    Re: Stripping characters from windows clipboard with win32clipboard from excel Dave Angel <davea@davea.name> - 2013-09-18 20:13 +0000
      Re: Stripping characters from windows clipboard with win32clipboard from excel Neil Hodgson <nhodgson@iinet.net.au> - 2013-09-19 07:40 +1000
        Re: Stripping characters from windows clipboard with win32clipboard from excel Dave Angel <davea@davea.name> - 2013-09-18 23:51 +0000
          Re: Stripping characters from windows clipboard with win32clipboard from excel Neil Cerutti <neilc@norwich.edu> - 2013-09-19 15:53 +0000
            Re: Stripping characters from windows clipboard with win32clipboard from excel Dave Angel <davea@davea.name> - 2013-09-19 19:58 +0000
    Re: Stripping characters from windows clipboard with win32clipboard from excel random832@fastmail.us - 2013-09-19 10:39 -0400

csiph-web