Copy to clipboard from IPython using Windows 7

2019-04-06 21:25发布

I am running IPython on Windows 7 and can use the %paste magic command to paste from the clipboard. However, I cannot copy from IPython to the clipboard. I want to copy code snippets from IPython and paste them back to a text editor.

Anyone know a fix for this?

2条回答
冷血范
2楼-- · 2019-04-06 22:26

Found this gist to add a %copy magic command, my fork adds supports osx/linux/windows platforms.

I have yet to test it on windows, so please tell me if you encounter any issues.

查看更多
Summer. ? 凉城
3楼-- · 2019-04-06 22:28

As mentioned by @AdrianRatnapala, you can right-click in the terminal window and select Mark, mark the code snippets you want to copy, and then right-click (the marked content is copied to the clipboard when you right-click).

A more "permanent way" to use this feature is to right-click on the title bar of the terminal window and choose Properties. Under the Options tab, tick the box next to QuickEdit Mode and save this setting.

A third option is to use IPython's Qt Console. You can use this by entering ipython qtconsole in the command prompt.

查看更多
登录 后发表回答