Created
November 7, 2018 14:49
-
-
Save inawrath/04febd9e561205042bc74a19d8362393 to your computer and use it in GitHub Desktop.
Copy to clipboard in IPython
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from IPython.core.magic import register_line_magic | |
@register_line_magic | |
def clip(line): | |
global_dict = globals() | |
if not line in global_dict: | |
return | |
value = global_dict[line] | |
import os | |
os.system("echo '%s' | pbcopy" % str(value)) | |
del clip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment