title: Beautiful Soup is adding whitespaces between every character
body: <p>I'm running Beautiful Soup on some HTML documents. All I want is to extract the text without any tags.</p>
  
  <pre><code>from bs4 import BeautifulSoup
  
  def aex_extract_text(html):
      soup = BeautifulSoup(html, 'lxml')
      text = soup.get_text()
      return text
  </code></pre>
  
  <p>My input is somewhat pathological in the number of redundant tags that it's got. But it is automatically generated HTML, so there shouldn't be any missing angles or anything of that nature. It's some Drupal system that creates the HTML. On almost all documents it runs fine, but on about 1/50 I'm getting the first few lines good and then whitespace between every character, and the tags aren't being removed. </p>
  
  <p>Anyone know what causes this sort of breakdown? I can't see anything obvious. The fact that it's breaking out in the middle of a paragraph is confusing. I don't need perfect preservation of the text, so if I need to pull out a few characters I don't mind.</p>
  
  <p>Example input:</p>
  
  <p>[...]</p>
  
  <pre><code>&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US CLASS=western ALIGN=JUSTIFY STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;BR&gt;  &lt;/P&gt;  &lt;P LANG=en-US 
  CLASS=western ALIGN=JUSTIFY STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;The 2&lt;/FONT&gt;&lt;/FONT&gt;&lt;SUP&gt;&lt;FONT 
  FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;nd&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;  Respondent was declared the duly 
  elected Member of Parliament for the  Chilanga Constituency.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US CLASS=western ALIGN=JUSTIFY STYLE=margin-bottom: 
  0cm; line-height: 150%&gt;  &lt;BR&gt;  &lt;/P&gt;  &lt;P LANG=en-US CLASS=western ALIGN=JUSTIFY STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;FONT FACE=Century 
  Gothic, serif&gt;&lt;FONT SIZE=3&gt;The result was  unsuccessfully challenged, in the High Court, to have it declared  null and void on a number of allegations 
  not relevant to this appeal  as it will be seen later in this judgment.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US CLASS=western ALIGN=JUSTIFY STYLE=margin-
  bottom: 0cm; line-height: 150%&gt;  &lt;BR&gt;  &lt;/P&gt;  &lt;P LANG=en-US CLASS=western ALIGN=JUSTIFY STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;FONT FACE=Century 
  Gothic, serif&gt;&lt;FONT SIZE=3&gt;It is also not in  dispute that the learned trial judge informed the parties of his  intention to call some witnesses 
  after the defence had closed its  case. Five witnesses, in total, were called by the court and they  were designated as court witnesses.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US CLASS=western ALIGN=JUSTIFY STYLE=margin-bottom: 
  0cm; line-height: 150%&gt;  &lt;BR&gt;  &lt;/P&gt;  &lt;P LANG=en-US CLASS=western ALIGN=JUSTIFY STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;This appeal is  premised on one ground of appeal 
  which is attacking the learned trial  judge&amp;rsquo;s jurisdiction to call witnesses on his own motion.
  </code></pre>
  
  <p>[...]</p>
  
  <p>Example output:</p>
  
  <p>[...]</p>
  
  <p>The 2nd  Respondent was declared the duly elected Member of Parliament for the  Chilanga Constituency.     The result was  unsuccessfully challenged, in the High Court, to have it declared  null and void on a number of allegations not relevant to this appeal  as it will be seen later in this judgment.     It is also not in  dispute that the learned trial judge informed the parties of his  intention to call some witnesses       a   f   t   e   r       t   h   e       d   e   f   e   n   c   e       h   a   d       c   l   o   s   e   d       i   t   s           c   a   s   e   .       F   i   v   e       w   i   t   n   e   s   s   e   s   ,       i   n       t   o   t   a   l   ,       w   e   r   e       c   a   l   l   e   d       b   y       t   h   e       c   o   u   r   t       a   n   d       t   h   e   y           w   e   r   e       d   e   s   i   g   n   a   t   e   d       a   s       c   o   u   r   t       w   i   t   n   e   s   s   e   s   .   /   F   O   N   T   >   /   F   O   N   T   >   /   P   >           P       L   A   N   G   =   e   n   -   U   S       C   L   A   S   S   =   w   e   s   t   e   r   n       A   L   I   G   N   =   J   U   S   T   I   F   Y       S   T   Y   L   E   =   m   a   r   g   i   n   -   b   o   t   t   o   m   :       0   c   m   ;       l   i   n   e   -   h   e   i   g   h   t   :       1   5   0   %   >           B   R   >           /   P   >           P       L   A   N   G   =   e   n   -   U   S       C   L   A   S   S   =   w   e   s   t   e   r   n       A   L   I   G   N   =   J   U   S   T   I   F   Y       S   T   Y   L   E   =   m   a   r   g   i   n   -   b   o   t   t   o   m   :   </p>
  
  <p>[...]</p>
  
  <p>UPDATE:</p>
  
  <p>here's the full input up to where it goes wrong:</p>
  
  <pre><code>&lt;!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN&gt;  &lt;HTML&gt;  &lt;HEAD&gt;    &lt;META HTTP-EQUIV=CONTENT-TYPE CONTENT=text/html; charset=windows-1252&gt;      &lt;TITLE&gt;&lt;/TITLE&gt;     &lt;META NAME=GENERATOR CONTENT=OpenOffice.org 3.3  (Win32)&gt;   &lt;META NAME=AUTHOR CONTENT=user&gt;     &lt;META NAME=CREATED CONTENT=20081007;9280000&gt;    &lt;META NAME=CHANGED CONTENT=20081007;9280000&gt;    &lt;STYLE TYPE=text/css&gt;   &lt;!--        @page { size: 21.59cm 27.94cm; margin-left: 2.54cm; margin-right: 2.54cm; margin-top: 1.27cm; margin-bottom: 2.54cm }       P { margin-bottom: 0.21cm; line-height: 115%; text-align: left }        P.western { font-family: Calibri, serif; font-size: 11pt; so-language: en-US }          P.cjk { font-family: Arial Unicode MS, sans-serif; so-language: en-US }         P.ctl { font-family: Calibri, serif; font-size: 11pt }      --&gt;     &lt;/STYLE&gt;  &lt;/HEAD&gt;  &lt;BODY LANG=en-ZA DIR=LTR STYLE=border: none; padding: 0cm&gt;  &lt;DIV TYPE=HEADER&gt;    &lt;P LANG=en-US ALIGN=CENTER STYLE=margin-bottom: 0cm; line-height: 0.18cm&gt;    &lt;SPAN STYLE=font-style: normal&gt;&lt;SPAN STYLE=font-weight: normal&gt;J   &lt;SDFIELD TYPE=PAGE SUBTYPE=RANDOM FORMAT=ARABIC&gt;26&lt;/SDFIELD&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;      &lt;P LANG=en-US STYLE=margin-bottom: 1.17cm; line-height: 0.18cm&gt;&lt;BR&gt;     &lt;/P&gt;  &lt;/DIV&gt;  &lt;P LANG=en-US CLASS=western ALIGN=RIGHT STYLE=margin-bottom: 0.35cm; line-height: 150%&gt;                                &lt;FONT FACE=Calibri, serif&gt;&lt;FONT SIZE=2 STYLE=font-size: 11pt&gt;&lt;SPAN LANG=en-US&gt;&lt;SPAN STYLE=font-style: normal&gt;&lt;SPAN STYLE=font-weight: normal&gt;              (706)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US CLASS=western STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;BR&gt;  &lt;/P&gt;  &lt;P LANG=en-US CLASS=western STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;IN THE SUPREME  COURT OF ZAMBIA                           SCZ APPEAL NO.182 OF 2007  &lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US CLASS=western STYLE=margin-bottom: 0.35cm&gt;&lt;A NAME=DDE_LINK&gt;&lt;/A&gt;  &lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;HOLDEN AT LUSAKA                                                       SCZ Judgment No.  31 OF 2008&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US CLASS=western STYLE=margin-bottom: 0.35cm&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;(CIVIL  JURISDICTION)&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US CLASS=western STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;BR&gt;  &lt;/P&gt;  &lt;P LANG=en-US CLASS=western STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;IN THE MATTER OF:             THE ELECTORAL ACT NO.12 OF 2006 SECTION 93 OF THE &lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;  &lt;/P&gt;  &lt;P LANG=en-US CLASS=western STYLE=margin-left: 3.81cm; text-indent: 1.27cm; margin-bottom: 0cm; line-height: 150%&gt;  &lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;LAWS OF ZAMBIA&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US CLASS=western STYLE=margin-left: 5.08cm; text-indent: -5.08cm; margin-bottom: 0cm; line-height: 150%&gt;  &lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;IN THE MATTER OF:       PARLIAMENTARY ELECTION FOR CHILANGA CONSTITUENCY HELD ON THE 28&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;TH&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;  SEPTEMBER, 2006&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US CLASS=western STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;IN THE MATTER OF:        AN ELECTION PETITION &lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;  &lt;/P&gt;  &lt;P LANG=en-US CLASS=western STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;BR&gt;  &lt;/P&gt;  &lt;P LANG=en-US CLASS=western STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;BETWEEN:&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US CLASS=western STYLE=margin-bottom: 0.35cm&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;       PRISCILLA  MWENYA KAMANGA         -      APPELLANT&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US CLASS=western STYLE=margin-bottom: 0.35cm&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;         AND&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US CLASS=western STYLE=margin-bottom: 0.35cm&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;        THE  ATTORNEY-GENERAL             -              1&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;ST&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;  RESPONDENT&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US CLASS=western STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;BR&gt;  &lt;/P&gt;  &lt;P LANG=en-US CLASS=western STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;      HON. NG&amp;rsquo;ANDU  PETER MAGANDE     -      2&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;ND&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;  RESPONDENT&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US CLASS=western STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;BR&gt;  &lt;/P&gt;  &lt;P LANG=en-US CLASS=western STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;CORAM :  Sakala,  CJ.,Chirwa, Mumba, Chitengi and Mushabati; JJS.&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US CLASS=western STYLE=margin-bottom: 0.35cm&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;On  25&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;TH&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;  June, 2006 and 19&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;th&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;  August, 2008&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US CLASS=western STYLE=margin-bottom: 0.35cm&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;For  the Appellants :  Mr.B.C. Mutale, SC. and Mr L. Kalaluka of Ellis and  Company&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US CLASS=western STYLE=margin-bottom: 0cm; border-top: none; border-bottom: 1.50pt solid #00000a; border-left: none; border-right: none; padding-top: 0cm; padding-bottom: 0.04cm; padding-left: 0cm; padding-right: 0cm; line-height: 150%&gt;  &lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;For the 1&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;st&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;  Respondent:  Mr M. Mukwasa &amp;ndash; State Advocate&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US CLASS=western STYLE=margin-bottom: 0.35cm&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;For  the 2&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;nd&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;  Respondent: Mr S.C. Malama, SC. of Jaques and Partners&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US CLASS=western STYLE=margin-bottom: 0.35cm&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;______________________________________________________________________________&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US CLASS=western ALIGN=CENTER STYLE=margin-bottom: 0cm; border-top: none; border-bottom: 1.50pt solid #00000a; border-left: none; border-right: none; padding-top: 0cm; padding-bottom: 0.04cm; padding-left: 0cm; padding-right: 0cm; line-height: 150%&gt;  &lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=4&gt;&lt;B&gt;JUDGMENT&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US CLASS=western STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;BR&gt;  &lt;/P&gt;  &lt;P LANG=en-US CLASS=western ALIGN=JUSTIFY STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;Mushabati, JS.,  delivered the judgment of the Court.&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US CLASS=western ALIGN=JUSTIFY STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;BR&gt;  &lt;/P&gt;  &lt;P LANG=en-US CLASS=western STYLE=margin-bottom: 0.35cm&gt;&lt;BR&gt;&lt;BR&gt;  &lt;/P&gt;  &lt;P LANG=en-US CLASS=western ALIGN=RIGHT STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;(707)&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US CLASS=western ALIGN=JUSTIFY STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;Cases referred to:&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;OL&gt;      &lt;LI&gt;&lt;P LANG=en-US ALIGN=JUSTIFY STYLE=margin-bottom: 0cm; line-height: 150%&gt;     &lt;FONT FACE=Calibri, serif&gt;&lt;FONT SIZE=2 STYLE=font-size: 11pt&gt;&lt;SPAN LANG=en-US&gt;&lt;SPAN STYLE=font-style: normal&gt;&lt;SPAN STYLE=font-weight: normal&gt;Double    Mwale Vs The People [1984] Z.R. 76&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;/OL&gt;  &lt;P LANG=en-US STYLE=margin-left: 1.27cm; margin-bottom: 0.35cm&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;B&gt;Simwanza  Vs The People [1985] Z.R.15&lt;/B&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US STYLE=margin-left: 1.27cm; margin-bottom: 0.35cm&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;B&gt;Jones  Vs National Coal Board [1957] 2. ALL  E.R. 155&lt;/B&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US STYLE=margin-left: 1.27cm; margin-bottom: 0.35cm&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;B&gt;Re  Enock and Zaretzky, Bock and Co. [1910] 1 K.B.327&lt;/B&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US STYLE=margin-left: 1.27cm; margin-bottom: 0.35cm&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;B&gt;Porter  Vs Magill [2002] 1 ALL E.R. 465&lt;/B&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US STYLE=margin-left: 1.27cm; margin-bottom: 0.35cm&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;B&gt;Fallow  Vs Calvert [1960] 2.Q.B. 201&lt;/B&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US STYLE=margin-left: 1.27cm; margin-bottom: 0.35cm&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;B&gt;Water  Welles Ltd Vs Jackson [1984] Z.R. 98&lt;/B&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US STYLE=margin-left: 1.27cm; margin-bottom: 0.35cm&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;B&gt;Zambia  Telecommunications Ltd Vs Celtel (Z) Ltd SCZ No. 90 of 2006  (unreported)&lt;/B&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US STYLE=margin-left: 1.27cm; margin-bottom: 0.35cm&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;B&gt;Mazoka  and others Vs Mwanawasa and others [2005] Z.R. 138&lt;/B&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US STYLE=margin-left: 1.27cm; margin-bottom: 0.35cm&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;B&gt;Thomas  Mumba and others Vs The People SCZ Appeal No. 92-95 (unreported) &lt;/B&gt;&lt;/FONT&gt;  &lt;/P&gt;  &lt;P LANG=en-US STYLE=margin-left: 1.27cm; margin-bottom: 0.35cm&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;B&gt;Lewanika  and others Vs Chiluba [1998] Z.R. 79&lt;/B&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US STYLE=margin-left: 1.27cm; margin-bottom: 0.35cm&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;B&gt;Mabenga  Vs Wina [2003] Z.R. 110&lt;/B&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US ALIGN=JUSTIFY STYLE=margin-left: 1.27cm; margin-bottom: 0cm; line-height: 150%&gt;  &lt;BR&gt;  &lt;/P&gt;  &lt;P LANG=en-US CLASS=western ALIGN=JUSTIFY STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;Legislation  referred to:&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US CLASS=western STYLE=margin-bottom: 0.35cm&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;B&gt;Criminal  Procedure Code, Cap. 87 &amp;ndash; S.149&lt;/B&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US CLASS=western STYLE=margin-bottom: 0.35cm&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;B&gt;Electoral  Act, No.12 of 2006 &amp;ndash; SS.102(3) and 103(1)(a) and (b)&lt;/B&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US CLASS=western ALIGN=JUSTIFY STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;BR&gt;  &lt;/P&gt;  &lt;P LANG=en-US CLASS=western ALIGN=JUSTIFY STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;Other works  referred to:&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US CLASS=western STYLE=margin-bottom: 0.35cm&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;B&gt;Halsburys  Laws of England 4&lt;/B&gt;&lt;/FONT&gt;&lt;SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;B&gt;th&lt;/B&gt;&lt;/FONT&gt;&lt;/SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;B&gt;  Edition Vol. 17 Page 195 Paragraph 281&lt;/B&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US CLASS=western ALIGN=JUSTIFY STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;BR&gt;  &lt;/P&gt;  &lt;P LANG=en-US CLASS=western ALIGN=JUSTIFY STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;This is an appeal  against the High Court judgment of 30&lt;/FONT&gt;&lt;/FONT&gt;&lt;SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;th&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;  July, 2007 dismissing the appellant&amp;rsquo;s petition against the  election of the 2&lt;/FONT&gt;&lt;/FONT&gt;&lt;SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;nd&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;  Respondent as a Member of Parliament for the Chilanga Parliamentary  Constituency during the Presidential and Parliamentary General  Elections held on 28&lt;/FONT&gt;&lt;/FONT&gt;&lt;SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;th&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;  September, 2006, seeking to nullify the 2&lt;/FONT&gt;&lt;/FONT&gt;&lt;SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;nd&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;  Respondent&amp;rsquo;s election on a number of malpractices as pleaded in  the petition.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US CLASS=western ALIGN=JUSTIFY STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;BR&gt;  &lt;/P&gt;  &lt;P LANG=en-US CLASS=western ALIGN=RIGHT STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;BR&gt;  &lt;/P&gt;  &lt;P LANG=en-US CLASS=western ALIGN=RIGHT STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;&lt;B&gt;(708)&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US CLASS=western ALIGN=JUSTIFY STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;BR&gt;  &lt;/P&gt;  &lt;P LANG=en-US CLASS=western ALIGN=JUSTIFY STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;We wish to state that  in the court below, the petition was prosecuted by two Petitioners  but the 2&lt;/FONT&gt;&lt;/FONT&gt;&lt;SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;nd&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;  Petitioner, Capt. Cosmas Moono, is not a party to this appeal.  However, for clarity&amp;rsquo;s sake we shall simply refer to the  appellant as the Petitioner and the 1&lt;/FONT&gt;&lt;/FONT&gt;&lt;SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;st&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;  and 2&lt;/FONT&gt;&lt;/FONT&gt;&lt;SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;nd&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;  Respondents as the 1&lt;/FONT&gt;&lt;/FONT&gt;&lt;SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;st&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;  and 2&lt;/FONT&gt;&lt;/FONT&gt;&lt;SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;nd&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;  Respondents respectively, the titles they held in the court below.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;  &lt;P LANG=en-US CLASS=western ALIGN=JUSTIFY STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;BR&gt;  &lt;/P&gt;  &lt;P LANG=en-US CLASS=western ALIGN=JUSTIFY STYLE=margin-bottom: 0cm; line-height: 150%&gt;  &lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;The undisputed facts  of this case are that both the Petitioner and the 2&lt;/FONT&gt;&lt;/FONT&gt;&lt;SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;nd&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;  Respondent contested the Parliamentary General Elections held on 28&lt;/FONT&gt;&lt;/FONT&gt;&lt;SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;th&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;  September, 2006 in the Chilanga Constituency. The Petitioner stood on  the Patriotic Front (PF) ticket; while the 2&lt;/FONT&gt;&lt;/FONT&gt;&lt;SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;nd&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SUP&gt;&lt;FONT FACE=Century Gothic, serif&gt;&lt;FONT SIZE=3&gt;  Respondent stood on the ticket of the Movement for Multiparty  Democracy (MMD).
  </code></pre>
  
  <p>UPDATE:</p>
  
  <p>I've voted to close my own question. The answer (which works) is here: 
  <a href="https://stackoverflow.com/questions/17859832/beautifulsoup-return-unexpected-extra-spaces">BeautifulSoup return unexpected extra spaces</a></p>