Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

Jupyter notebook prevent new cells from inheriting values from previous cells but outputs to be visible

$
0
0

1st code block:

import logginglogging.basicConfig(level=logging.DEBUG)logging.debug("debug1abc")logging.info("info1abc")logging.warning("warning1abc")logging.error("error1abc")logging.critical("critical1abc")

The output for this if run separately::

DEBUG:root:debug1abcINFO:root:info1abcWARNING:root:warning1abcERROR:root:error1abcCRITICAL:root:critical1abc

2nd code block:

import logginglogging.debug("debug1xyz")logging.info("info1xyz")logging.warning("warning1xyz")logging.error("error1xyz")logging.critical("critical1xyz")

The output for this if run separately:

WARNING:root:warning1xyzERROR:root:error1xyzCRITICAL:root:critical1xyz

Now if I run both of these cells in a in cell 1, and in cell 2 [of the same notebook], both the outputs would be same [which is the 1st code's output].[[EDIT: meaning 5abc outputs, 5 xyz outputs]]

How can I get both the outputs if I run in the same notebook and make the outputs visible too? I know we can "clear outputs" to have the 2nd cell to run without saving the previous outputs.But I want the outputs to be visible too in the cell output and get these different outputs for each cell.

Is it not possible at all ?

Unsure on how the clear_ouptut is done


Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>