Joining a list in python with different conditions and separator : <p>I have a list of integer</p>

<p><code>a=[1,2,3,4,5,6,7,8,9]</code></p>

<p>and i must create a string with the integers separated by spaces and every five number i must add a '\n'</p>

<p><code>string='1 2 3 4 5\n6 7 8 9\n\n'</code></p>

<hr>

<p>I have tried with a join like that:</p>

<p><code>string=' '.join(a)</code></p>

<p>but i don't know how to add '\n' with a condition.</p>
