Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

In the ipython notebook, I would like to programatically read and execute code cells from within a code cell itself.

Something like

if condition:
  # run input cell no. 3

I found a solution here, the function execute_notebook reads an ipynb file cell by cell and executes code cells using get_ipython().run_cell().

Is there a way to do the same, i.e. without reading the cells from the an external ipynb file first? Is there a way to write macros, to reference and access code cells from within an ipython notebook?

share|improve this question
    
Did you find anything since you asked the question? –  snooze92 Jul 25 '14 at 7:35
    
Please let us know if you found a solution. This is going to be very useful in a work project very soon. –  Who8MyLunch Oct 13 '14 at 3:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.