title: How to maintain number formatting while fetching webpages using BeautifulSoup?
body: <p>I'm trying to fetch a webpage which contains numbers with superscripts, fractions in numerator &amp; denominator format. The fetched content is being saved to a document file. For that purpose, I'm using python-docx module. For ex. The expression 112 x 5<sup>4</sup> is saved as 112 x 54 &amp; fraction &frac14; as 1 (newline)(tab) 4. I am using Python 3.5 &amp; Windows 8.1 OS</p>
  
  <p>Code- </p>
  
  <pre><code># This script heavily relies on the HTML structure of webpages mentioned below 
  # indiabix.com/aptitude/simple-interest, indiabix.com/aptitude/numbers which are similar
  
      import sys
      import urllib.request
      from docx import Document
      from bs4 import BeautifulSoup
  
      soup = ""
      para = ""
      root = "http://www.indiabix.com"
  
      def getQuestions(link):
          req = urllib.request.urlopen(link)
          soup = BeautifulSoup(req.read(),'html5lib')
          boxes = soup.find_all('div',{'class':'bix-div-container'})
  
          for box in boxes:
              headers = box.find("td",{"class":"bix-td-qtxt"})
              para = doc.add_paragraph(headers.get_text())
  
              options = box.find_all("td",{'class':'bix-td-option'})
  
              para.text += "\n"
              for option in options:
                  para.text = para.text + (option.get_text()+" ")
          return soup
  
      def getExtras(soup):
          main = soup.find('p',{'class':'ib-pager'}).find_all('a')
          for m in main[:-1]:
              getQuestions(root+m['href']) 
          return
  
      if __name__ == '__main__':
          # Here, the string "http://indiabix.com/aptitude/numbers" is used as the input link
          link = input("Enter link : ")   
          doc = Document()
          soup = getQuestions(link)
          getExtras(soup)
          doc.save('questions.docx')
  </code></pre>