How to copy python variable into clipboard
- bdata3
- Jan 22, 2020
- 1 min read
Updated: Feb 17, 2020
Michael Yin - wrote a very nice snippet of code for ipython and Jupiter notebook
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))
a = 'test '*10
%clip a

Comments