title: Copy the output of `print` to clipboard directly
body: <p>I use <code>inspect.getsource</code> to check the libs I imported:</p>
  
  <pre><code>In[52]: from django.views.generic import View
  In[53]: view_code = inspect.getsource(View)
  In[54]: len(view_code)
  Out[54]: 3242
  </code></pre>
  
  <p>Retrieve the formatted codes</p>
  
  <pre><code>In[55]: print(view_code)
  
  class View(object):
      """
      Intentionally simple parent class for all views. Only implements
      dispatch-by-method and simple sanity checking.
      """
  
      http_method_names = ['get', 'post', 'put',
                          'patch', 'delete', 'head', 'options', 'trace']
  
      def __init__(self, **kwargs):
  </code></pre>
  
  <p>I'd like to store the codes to my notes for further reference,<br>
  to do this, I have to scroll through the entire code with the purpose to copy it.<br>
  It's not convenient if the codes are long enough.</p>
  
  <p>How could I copy the output of <code>print</code> to clipboard in a straight-forward way?</p>