def html_strip(text):
 mark = 0
 markstart = 0
 markend = 0
 index = 0
 occur = 0
 for i in text:
  if (i == '<'):
   try:
    if (text[(index + 1)] != ' '):
     mark = 1
     markstart = index
   except IndexError:
    pass
  elif (i == '>'):
   if (mark == 1):
    mark = 0
    markend = index
    text = ('%s%s' % (text[:markstart], text[(markend + 1):]))
    occur = 1
    break
  index += 1
 if (occur == 1):
  text = html_strip(text)
 return text

def html_strip ( text ) : mark = 0 markstart = 0 markend = 0 index = 0 occur = 0 for i in text : if ( i == '<' ) : try : if ( text [ ( index + 1 ) ] != ' ' ) : mark = 1 markstart = index except IndexError : pass elif ( i == '>' ) : if ( mark == 1 ) : mark = 0 markend = index text = ( '%s%s' % ( text [ : markstart ] , text [ ( markend + 1 ) : ] ) ) occur = 1 break index += 1 if ( occur == 1 ) : text = html_strip ( text ) return text
strips html markup from text .