Stripping characters from windows clipboard with win32clipboard from excel

random832 at fastmail.us random832 at fastmail.us
Wed Sep 18 15:19:38 EDT 2013


On Fri, Sep 13, 2013, at 12:09, random832 at fastmail.us wrote:
> Anyway, to match behavior found in other applications when pasting from
> the clipboard, I would suggest using:
> 
> if s.contains('\0'): s = s[:s.index('\0')]
> 
> Which will also remove non-null bytes after the first null (but if the
> clipboard contains these, it won't be pasted into e.g. notepad).

I did some testing and confirmed you MUST do this - if you copy multiple
things from Excel, it may reuse this buffer and not clear the end of it.



More information about the Python-list mailing list