Python Forum
code for CSV file to html file without pandas
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
code for CSV file to html file without pandas
Need to write information into csv and then transfer this information to HTML file.
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.
# 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:
        td = '<td>'
        for fn in reader.fieldnames:
<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>

Possibly Related Threads…
Thread Author Replies Views Last Post
  Problem in saving .xlsm (excel) file using pandas dataframe in python shantanu97 2 234 Aug-29-2021, 12:39 PM
Last Post: snippsat
  Dictionary within html code ebolisa 4 332 Aug-09-2021, 11:36 AM
Last Post: ebolisa
Sad SyntaxError: from simple python example file from mind-monitor code (muse 2) warmcupoftea 4 370 Jul-16-2021, 02:51 PM
Last Post: warmcupoftea
  reading html and edit chekcbox to html jacklee26 5 583 Jul-01-2021, 10:31 AM
Last Post: snippsat
  Read file, reformat and write new file bryanmartin113 1 508 Jun-08-2021, 09:27 PM
Last Post: Larz60+
  How to save modification of a file in original file not a new one? mjrezayani 3 748 Jun-04-2021, 01:28 PM
Last Post: snippsat
  Subprocess.Popen() not working when reading file path from csv file herwin 13 1,692 May-07-2021, 03:26 PM
Last Post: herwin
  Copy column from one existing excel file to another file mkujawsk 0 614 Apr-14-2021, 06:33 PM
Last Post: mkujawsk
  Request for Python code - Features extraction from JSON file (cuckoo) thinker 1 556 Apr-07-2021, 04:40 PM
Last Post: Larz60+
  Move file from one folder to another folder with timestamp added end of file shantanu97 0 556 Mar-22-2021, 10:59 AM
Last Post: shantanu97

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020