title: Importing between different versions of python
body: <p>I have a notebook in python 2 and a notebook in python 3. Code written in the notebook 2 is cannot be directly transfered to python 3 due to syntax differences. However, I do not want to import the code, I only want to import the final answer I got after running the code.</p>
  
  <pre><code>Notebook_A: Python 2
  
  def func(x):
      print x
      return x
  
  z = f(3) #z is now 3, I want to import the value 3.
  
  Notebook_B: Python 3
  
  from Notebook_A import z
      SyntaxError: missing parentheses in call to 'print'
  </code></pre>
  
  <p>Now I could go back to func and modify the code so that it matches python 3 syntax, but in the case that func is more complicated, I was wondering if there is a more general way. Is there a way to somehow just save the final value of a variable so that the notebook can forget about the code that generated the value?</p>
  
  <p>Thanks</p>