title: Scraping table in wikipedia with Python
body: <p>I want to scrape the table with postal codes of Toronto in this wikipedia <a href="https://en.wikipedia.org/wiki/List_of_postal_codes_of_Canada:_M" rel="nofollow noreferrer">page</a>.</p>
  
  <p>Regardless I use the pandas method or beautifulSoup it just won't work although others reported that it should work. Kindly asking you to give your hints:</p>
  
  <p>Pandas:</p>
  
  <pre><code>df = pd.read_html('https://en.wikipedia.org/wiki/List_of_postal_codes_of_Canada:_M')[0]
  </code></pre>
  
  <p>beautifulSoup:</p>
  
  <p>According other guys the output table by use of codes in image should be as the table in image 'expexted output with beautifulSoup'</p>
  
  <p>output of beautifulSoup</p>
  
  <p><a href="https://i.stack.imgur.com/zHwCO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zHwCO.png" alt=""></a></p>
  
  <p>Expected output with beautifulSoup</p>
  
  <p><a href="https://i.stack.imgur.com/axWg2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/axWg2.png" alt=""></a></p>