  </div>
      <p>
        <strong>Explanation:</strong> The <code>for</code> loop goes through each line in the file. <code>strip()</code>
        removes unnecessary spaces.
      </p>


      <h2>3. Writing to a File</h2>
      <p>
        To write new data to a file, we use the <code>write()</code> method. However, be careful when using
        <code>'w'</code> mode, because it will erase everything already in the file and replace it with the new content
        you write.
      </p>

      <h3>Example 