如何清除ipython中的变量? [英] How to clear variables in ipython?

查看:21
本文介绍了如何清除ipython中的变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时我在同一个 ipython 会话中重新运行一个脚本,但当变量没有被清除时,我会感到意外.如何清除所有变量?每次我调用魔术命令 %run 时,是否可以以某种方式强制执行此操作?

Sometimes I rerun a script within the same ipython session and I get bad surprises when variables haven't been cleared. How do I clear all variables? And is it possible to force this somehow every time I invoke the magic command %run?

谢谢

推荐答案

%reset 似乎清除了定义的变量.

%reset seems to clear defined variables.

这篇关于如何清除ipython中的变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆