How to turn newlines in a file to lines extending to end of line?
<p>I am copying <a href="http://stackoverflow.com/questions/7633485/insert-string-at-the-beginning-of-each-line/7633962#7633962">this answer</a> like this</p>

<pre><code>for line in fileinput.input(['my_file'], inplace=True):
    sys.stdout.write('_____ {l}'.format(l=line))
</code></pre>

<p>to add four underlines to beginning of line. This turns <code>my_file</code> into a checklist. But the above code prints the underlines on the blank lines too. I want to change the blank lines to full length lines. How do I do that? So if the original lines are like this</p>

<pre><code>abc

def

ghi
</code></pre>

<p>the checklist will look like</p>

<pre><code>___ abc

_________________________________________________

___ def

_________________________________________________

___ ghi

_________________________________________________
</code></pre>

<hr>

<p>Thanks!</p>
