Apr-24-2021, 05:51 PM
Apr-24-2021, 09:41 PM
There are many other libraries PyPi this if don't want to use Pandas eg CSVtoTable
If doing as training i can write a start example of one way it could be done.
If doing as training i can write a start example of one way it could be done.
Output:# test.csv
Identifier,First name,Last name
901242,Rachel,Booker
207074,Laura,Grey
408129,Craig,Johnson
import csv with open("test.csv") as csvfile: reader = csv.DictReader(csvfile, delimiter=",") for row in reader: print("<tr>") td = '<td>' for fn in reader.fieldnames: print(f"{td:>6}{row[fn]}</td>") print("</tr>")
Output:<tr>
<td>901242</td>
<td>Rachel</td>
<td>Booker</td>
</tr>
<tr>
<td>207074</td>
<td>Laura</td>
<td>Grey</td>
</tr>
<tr>
<td>408129</td>
<td>Craig</td>
<td>Johnson</td>
</tr>