title: Save by cell and not by line #: IPython %save magic: Is there a way?
body: <p>I'm creating a Django tutorial in an IPython Notebook and I want to use the <code>%save</code> magic to save <code>.py</code> files  to create / edit / advance a website as the tutorial progresses. The problem is the <code>%save</code> magic works by specifying which lines to save. Undoubtedly, the line number will change when users execute the cells before the file out of order or multiple times. </p>
  
  <p>I'd like to work like this:</p>
  
  <pre><code>some .py file imported into the notebook.
  # do all sorts of website things
  %save -f this.py file
  </code></pre>
  
  <p>where it would save the contents of the cell without needing the line number. Is there any way to do this with the existing functionality of the <code>%save</code> magic?</p>