我使用Jupyter Notebook编写一个小程序。因此,我想将一些单元格写入.py文件。
我用这种魔法%%writefile -a myfile.py。它可以工作,但是问题是内容没有新行添加。因此,我必须myfile.py在运行单元格后手动向其中添加换行符。
%%writefile -a myfile.py
myfile.py
如何避免这个问题?
python jupyter
jupyter ×1
python ×1