gpt4 book ai didi

IPython %save 魔法错误

转载 作者:行者123 更新时间:2023-12-04 17:50:47 24 4
gpt4 key购买 nike

我正在尝试使用 %loadpy 保存我加载到我的 IPython 笔记本中的 python 文件。魔法。当我尝试使用 %save settings.py 保存文件时我收到以下错误:

File `settings.py` exists. Use `%save -f 'settings.py' -f` to force overwrite

然后当我使用 %save -f 'settings.py' -f我收到错误:
'-f' was not found in history, as a file, url, nor in the user namespace.
%save -f 'settings.py'产生错误 '' was not found in history, as a file, url, nor in the user namespace.以及。

知道如何正确保存 .py文件,以便它覆盖以前的版本?谢谢!

最佳答案

In [13]: %save -f settings.py 1-10 # saves lines 1 to 10 to settings.py
In [14]: %save? # Gives you the help on the save command


Usage:
%save [options] filename n1-n2 n3-n4 ... n5 .. n6 ...

n1-n2、n3-n4 是要保存的行范围。 n5、n6 是您要保存的单个行号。添加 -f强制保存选项。

关于IPython %save 魔法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17034910/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com