Stripping characters from windows clipboard with win32clipboard from excel

stephen.boulet at gmail.com stephen.boulet at gmail.com
Fri Sep 13 10:38:09 EDT 2013


On Friday, September 13, 2013 9:31:45 AM UTC-5, stephen... at gmail.com wrote:
> On Thursday, September 12, 2013 10:43:46 PM UTC-5, Neil Hodgson wrote:
> 
> > Stephen Boulet:
> 
> > 
> 
> > 
> 
> > 
> 
> > >  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.
> 
> > 
> 
> > 
> 
> > 
> 
> >     Looks like Excel is rounding up its clipboard allocation to the next 
> 
> > 
> 
> > 64K. There used to be good reasons for trying to leave some extra room 
> 
> > 
> 
> > on the clipboard and avoid reallocating the block but I thought that was 
> 
> > 
> 
> > over a long time ago.
> 
> > 
> 
> > 
> 
> > 
> 
> >     To strip NULs off the end of the string use s.rstrip('\0')
> 
> 
> 
> Hm, that gives me a "Type str doesn't support the buffer API" message.

Aha, I need to use str(s, encoding='utf8').rstrip('\0').



More information about the Python-list mailing list