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

夙愿已清 提交于 2019-12-22 10:36:28

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/38798181/ipython-is-there-a-way-to-answer-y-to-or-ignore-all-y-n-prompts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!