Python: line break in a textfile after specific word
<p>I have a textfile and there's just one line with 10.000 words. 
Now I want to add a line break before a specific word ("Comment") appears and I also want to write this in a new textfile:</p>

<p>The textfile looks like: "Comment: Yeah, you're right Comment: That's very interesting Comment: really?</p>

<p>And the new file should looks like:</p>

<pre><code>    Comment: Yeah, you're right
    Comment: That's very interesting
    Comment: really?
</code></pre>

<p>I tried this code below but there's something wrong. I'm a beginner and until now, I wasn't able to find a solution. Thanks for your help</p>

<pre><code>    -*- coding: utf-8 -*-

    d = file('test.txt','r')
    text=d.read()
    e = file('output.txt','w')
    x=raw_input("Insert word:")
    # -&gt; Comment
    for line in d.readlines():
          if line.startswith(x):
            word.append(+"\n")
            e.write()
            e.close()
            d.close()
</code></pre>
