multiple lines in a for loop block in python
<p>I have a very basic question in python. I want to split the items in the following list and print it in a text file.</p>

<pre><code>import pandas as pd
s = ['"9-6": 1', ' "15-4": 1', ' "12-3": 1', ' "8-4": 1', ' "8-5": 1', ' "8-1": 1']
print type(s)
for i in s:
     j = i.split(',')
     with open("out.txt","w") as text_file:
             text_file.write("{}".format(j))
</code></pre>

<p>However, my code only prints the last value. Clearly, it is not taking the last lines inside the for loop block. Can anyone point where am I going wrong? Thanks!</p>