title: How to append a file with a newline using %%writefile -a command in jupyter?
body: <p>I use a Jupyter Notebook to write a small program. Therefore, I want to write some cells into a .py file. </p>
  
  <p>I use this magic <code>%%writefile -a myfile.py</code>. It works, but the problem is that the content is appended without a new line. So, I have to manually add a line break to <code>myfile.py</code> after running the cells.</p>
  
  <p>How can I avoid this problem? </p>