ChristineB ChristineB - 2 months ago 10x
Python Question

iPython- Is there a way to answer "y" to (or ignore) all y/n prompts?

So I have an ipython notebook that has a lot of large variables, and at one point I want to get rid of all the ones I'm done with. I'm using %reset_selective variablename to clear each one, but there's 60 of these variables and when I run the block that has all 60 prompts, it asks me to enter y/n for every clear.

"Once deleted, variables cannot be recovered. Proceed (y/[n])?"

Is there a way I can answer "y" for all of them at once, or to skip the prompt altogether?


Reading from here:

%reset_selective [-f] regex

No action is taken if regex is not included

Options -f : force reset without asking for confirmation.

Seems you're able to pass -f flag to %reset_selective to have it force without asking.