top of page
Search

How to copy python variable into clipboard

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


ree


 
 
 

Comments


Subscribe Form

©2019 by Big Data. Proudly created with Wix.com

bottom of page