To extract the Python code from within a notebook document, there are several options available like using the ``download as .py`` option or converting the notebook using ``ipython nbconvert``, as described above.