How to Run a Cell in Jupyter Notebook Only If a Value Is Null?

22 Replies, 1935 Views

Yo, I feel like everyone’s overcomplicating this. Just use a simple `if-else` and suppress output with `;` at the end of the line.

```python
if some_value is None:
print("Value is null, doing stuff now!")
else:
pass;
```

This will skip the cell output if the value isn’t null. Sometimes the simplest solution is the best!

Messages In This Thread



Users browsing this thread: 1 Guest(s)