clipboard

Copying MultiIndex dataframes with pd.read_clipboard?

戏子无情 提交于 2019-11-26 13:52:48
问题 Given a dataframe like this: C A B 1.1 111 20 222 31 3.3 222 24 333 65 5.5 333 22 6.6 777 74 How do I read it in using pd.read_clipboard ? I've tried this: df = pd.read_clipboard(index_col=[0, 1]) But it throws an error: ParserError: Error tokenizing data. C error: Expected 2 fields in line 3, saw 3 How can I fix this? Other pd.read_clipboard questions: How do you handle column names having spaces in them when using pd.read_clipboard? How to handle custom named index when copying a dataframe

Leave out quotes when copying from cell

假如想象 提交于 2019-11-26 13:09:49
问题 Problem : When copying a cell from Excel outside of the program, double-quotes are added automatically. Details : I'm using Excel 2007 on a Windows 7 machine. If I have a cell with the following formula: ="1"&CHAR(9)&"SOME NOTES FOR LINE 1."&CHAR(9)&"2"&CHAR(9)&"SOME NOTES FOR LINE 2." The output in the cell (formatted as number) looks like this in Excel: 1SOME NOTES FOR LINE 1.2SOME NOTES FOR LINE 2. Well and good. But, if I copy the cell into another program, such as notepad, I get annoying

How to copy/paste DataFrame from Stack Overflow into Python

白昼怎懂夜的黑 提交于 2019-11-26 12:58:33
问题 In questions and answers, users very often post an example DataFrame which their question/answer works with: In []: x Out[]: bar foo 0 4 1 1 5 2 2 6 3 It\'d be really useful to be able to get this DataFrame into my Python interpreter so I can start debugging the question, or testing the answer. How can I do this? 回答1: Pandas is written by people that really know what people want to do. Since version 0.13 there's a function pd.read_clipboard which is absurdly effective at making this "just

How to set HTML to clipboard in C#?

白昼怎懂夜的黑 提交于 2019-11-26 12:48:27
问题 I want to put rich text in HTML on the clipboard so when the users paste to Word, it will include the source HTML formatting. Using the Clipboard.SetText method doesn\'t work. Also, I would like that if users paste into a rich editor like Word it will paste formatted text, and if they paste into a plain editor like Notepad it will paste plain text. 回答1: When setting HTML text, you need to provide a header with additional information to what fragment of the html you actually want to paste

How to copy string to clipboard in C?

这一生的挚爱 提交于 2019-11-26 12:40:49
问题 The SetClipboardData function requires a HANDLE reference; I\'m having trouble converting my string for use in the function. Here is my code: char* output = \"Test\"; HLOCAL hMem = LocalAlloc( LHND,1024); char* cptr = (char*) LocalLock(hMem); memcpy( cptr, output, 500 ); SetClipboardData(CF_TEXT, hMem); LocalUnlock( hMem ); LocalFree( hMem ); CloseClipboard(); What am I doing wrong here and what\'s the proper way to do it? Thanks. 回答1: Read the MSDN documentation for the SetClipboardData

Use clipboard from VBScript

血红的双手。 提交于 2019-11-26 12:28:36
问题 I am looking for a method to place some text onto the clipboard with VBScript. The VBScript in question will be deployed as part of our login script. I would like to avoid using anything that isn\'t available on a clean Windows XP system. Edit: In answer to the questions about what this is for. We wanted to encourage users inside our organization to use the file server to transfer documents instead of constantly sending attachments by email. One of the biggest barriers to this is that it isn\

Webcam usage in C#

﹥>﹥吖頭↗ 提交于 2019-11-26 12:12:31
问题 I am making a program in C# to connect to a webcam and do some image manipulation with it. I have a working application that uses win32 api (avicap32.dll) to connect to the webcam and send messages to it that sends it to the clipboard. The problem is that, while accesible from paint, reading it from the program results in null pointers. This is the code I use to connect the webcam: mCapHwnd = capCreateCaptureWindowA(\"WebCap\", 0, 0, 0, 320, 240, 1024, 0); SendMessage(mCapHwnd, WM_CAP_CONNECT

Copying From and To Clipboard loses image transparency

半腔热情 提交于 2019-11-26 11:25:22
I've been trying to copy a transparent PNG image to clipboard and preserve its transparency to paste it into a specific program that supports it. I tried many solutions already but the background always ended up gray in one way or another. So I tried copying the same image using Chrome and pasting it into the program and it worked. It preserved transparency. So then I tried Getting the image from the Clipboard that I had copied using Chrome and Set the image again, expecting the transparency to still be there - but no, transparency was not preserved even though I just took the image from the

CLIPBRD_E_CANT_OPEN error when setting the Clipboard from .NET

此生再无相见时 提交于 2019-11-26 11:24:43
问题 Why does the following code sometimes causes an Exception with the contents \"CLIPBRD_E_CANT_OPEN\": Clipboard.SetText(str); This usually occurs the first time the Clipboard is used in the application and not after that. 回答1: Actually, I think this is the fault of the Win32 API. To set data in the clipboard, you have to open it first. Only one process can have the clipboard open at a time. So, when you check, if another process has the clipboard open for any reason , your attempt to open it

Get readable text only from clipboard

旧街凉风 提交于 2019-11-26 10:57:10
问题 I already know how to get plain text from the clipboard in Java, but sometimes the text is encoded in some weird DataFlavor , like when copying from Microsoft Word or from a website or even source code from Eclipse. How to extract pure plain text from these DataFlavor s? 回答1: import java.awt.HeadlessException; import java.awt.Toolkit; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.UnsupportedFlavorException; import java.io.IOException; String data = (String) Toolkit