title: Concatenate `difflib.HtmlDiff` instances
body: <h2>Objective &amp; Question</h2>
  <p>I have a file with 'database' entries, each with a number of items. I want to show an entry-by-entry comparison (instead of a global comparison where the comparison might get avoidably lost).</p>
  <p>Loosely speaking my question is: <strong>How do I concatenate <code>difflib.HtmlDiff</code> instances?</strong>.</p>
  <h2>Example &amp; Current workaround</h2>
  <p>Consider this example, with my current workaround of just concatenating multiple HTML pages:</p>
  <pre class="lang-py prettyprint-override"><code>import difflib
  
  a0 = &quot;&quot;&quot;
  Foo2022:
      title: Foo
      journal: Journal of Foo
  &quot;&quot;&quot;
  
  a1 = &quot;&quot;&quot;
  Foo2022:
      title: Foo
      journal: J. of Foo
  &quot;&quot;&quot;
  
  b0 = &quot;&quot;&quot;
  Bar2022:
      title: Bar
      journal: Journal of Bar
  &quot;&quot;&quot;
  
  b1 = &quot;&quot;&quot;
  Bar2021:
      title: Description of bar
      journal: J. of Bar
  &quot;&quot;&quot;
  
  diff_a = difflib.HtmlDiff(wrapcolumn=100).make_file(
      a0.splitlines(keepends=True),
      a1.splitlines(keepends=True),
  )
  
  diff_b = difflib.HtmlDiff(wrapcolumn=100).make_file(
      b0.splitlines(keepends=True),
      b1.splitlines(keepends=True),
  )
  
  with open(&quot;t.html&quot;, &quot;w&quot;) as file:
      file.write(diff_a + diff_b)
  </code></pre>
  <p>This, however, gives multiple legends (and incorrect line-numbers, but that I could live with).
  I could, of course, strip things from the HTML files, but I would like to avoid this as it reduces maintainability and readability.</p>