-3

I want to read the data from a url which gives an HTML table as output. After reading the data I need the data in the csv format, just like the page itself.

Below mentioned is the HTML output.

enter image description here

HTML Source Code:

<html>
   <body>
    <h1> Below are the order details for the recallID. Download as <a href=http://sp-ff-im.nm.flipkart.com:18700/seller_returns/67795/details/download oncontextmenu="return false;">CSV</a><br>
    <table border='1'>
          <tr>
              <th>SellerID</th>
              <th>ShipmentID</th>
              <th>OrderItemID</th>
              <th>OrderId</th>
              <th>Quantity</th>
              <th>listingID</th>
              <th>FSN</th>
              <th>SKU</th>
          </tr>
          <tr>
              <td>da473f06039a45e7</td>
              <td>S167965494</td>
              <td>4579250217234000</td>
              <td>OD405792502172340000</td>
              <td>1</td>
              <td>LSTCOME9YJK7VTFRPTNZR0HFM</td>
              <td>COME9YJK7VTFRPTN</td>
              <td>Dell 3558 Notebook</td>
          </tr>
          <tr>
              <td>da473f06039a45e7</td>
              <td>Mis-shipment</td>
              <td>ii_id:242950951</td>
              <td>Received from Mis-Shipment</td>
              <td>1</td>
              <td>LSTCOME9YJK7VTFRPTNZR0HFM</td>
              <td>COME9YJK7VTFRPTN</td>
              <td>Dell 3558 Notebook</td>
          </tr>
     </table>
   </body>
</html>
Ishita Sinha
  • 2,168
  • 4
  • 25
  • 38

1 Answers1

0

I think you can combine these two StackOverflow answers to get what you need:

html table -> python list

python list -> csv

Community
  • 1
  • 1
grepe
  • 1,897
  • 2
  • 14
  • 24