告诉 ipython 保留临时文件
有几次,由于 ipython 的 %edit 功能,我在一些临时文件中获得了一些代码,并且通过一些悲惨的事件序列或其他事件,我最终在永久保存代码之前退出了 shell。
是否有任何设置可以生成临时文件,我该怎么说......不是那么临时?
There have been a few occasions in which I've got some code in some temp files thanks to ipython's %edit feature, and through some tragic sequence of events or other I end up exiting the shell before saving the code permanently.
Is there any setting anywhere that makes the temporary files, how should I say this ... not so temporary?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
即使退出 shell 后,您也可以使用
%edit filename.py
来保留您的编辑。如果你想使用临时文件,你可以尝试配置你的 编辑器自动保存它们。您还可以破解 ipython 源并阻止 shell 在退出时清理临时文件:只需注释 “# Cleanup all tempfiles left around”之后的 5 行。只是一个想法:)
you can use
%edit filename.py
to keep your edits even after quitting the shell. if you want to use temp files, you could try configuring your editor to automatically save them.you could also hack the ipython source and prevent the shell from cleaning up temp files when exiting: just comment the 5 lines after "# Cleanup all tempfiles left around". just an idea :)