Also, if you wanted a static version that would drop all those cells in addition to a tag you could use the regexRemovePreprocessor (with an nbconvert config option) to automatically remove all cells that match a regular expression that matches exactly those characters.
On Tue, Dec 26, 2017 at 11:09 M Pacer <[email protected]> wrote: > If you want a clean environment you can include a cell that runs > > %reset -f > > That will reset your environment to a clean state if you don’t want any > of the variables to carry over. But then people would need to execute that > cell. > > On Tue, Dec 26, 2017 at 06:43 <[email protected]> wrote: > >> Can we programmatically have the notebook "forget" all prior code >> snippets as well so we effectively have a "clean" environment for a new >> section? >> >> >> On Wednesday, 20 December 2017 05:33:30 UTC-5, Fernando Perez wrote: >>> >>> On Mon, Dec 18, 2017 at 10:48 PM, Roland Weber <[email protected]> >>> wrote: >>> >>>> Restart the kernel before each section. That will clear all state in >>>> memory, and reset the execution count >>>> >>> >>> You can also force that number to be any value with: >>> >>> ip = get_ipython() >>> ip.history_manager.enabled = False # needed to avoid duplicate line # >>> error messages >>> ip.execution_count = 0 # your number here >>> >>> and it will start counting at that number from then on. OP could put >>> that in a little utility/magic that resets it to 1, and then drop those >>> cells from the book output with a tag. >>> >>> Visual example: >>> >>> [image: Inline image 1] >>> >>> cheers, >>> >>> f >>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "Project Jupyter" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/jupyter/9bfd0c07-0fc6-4dc2-8574-426c8f76c040%40googlegroups.com >> <https://groups.google.com/d/msgid/jupyter/9bfd0c07-0fc6-4dc2-8574-426c8f76c040%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- You received this message because you are subscribed to the Google Groups "Project Jupyter" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/CAM3SX444GZOthe%2B_R0VvbzJNZerXY8n%2B00XCgB4Ru8k1F%2B8xxA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
