扫码关注官方订阅号
如题。 linux中 可以 del a* 删除 a打头的所有变量,在python中怎样执行? 需要删除 前面一个py文件中定义的所有变量,怎样执行?
闭关修行中......
感觉这么做挺危险的,应该有更合适的办法吧。
pythonfrom other_module import * import other_module print(locals()) for i in dir(other_module): if i.startswith('fav'): locals().pop(i) print(locals())
python
from other_module import * import other_module print(locals()) for i in dir(other_module): if i.startswith('fav'): locals().pop(i) print(locals())
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
感觉这么做挺危险的,应该有更合适的办法吧。