manipulate text file line by line or as a whole string?
<pre><code>for line in open('file.txt'):
    print(re.sub('windows', 'linux', line))
</code></pre>

<p>or</p>

<pre><code>print(re.sub('windows', 'linux', open('file.txt').read()))
</code></pre>

<p>Which one is better? Is there any differences?<br>
BTW. Is is a good idea to manipulate a huge string with a <code>regex</code>?</p>
