HTML Tables Revisited

Download this shortened name and wage file. You will be using it to generate some HTML output.

Tasks

  1. Write a function makeHTMLNamesList. This function should read data from the name and wage file, extract all the names from that csv, and then output HTML representing that list of names

    As a refresher: the following html specifies an ordered list ol of 4 list items li. (NOTE: the whitespace/indentation/newlines are optional, html ignores them)
    <ol>
        <li>Alice</li>
        <li>Bob</li>
        <li>Clara</li>
        <li>Dave</li>
    </ol>
    

    Your code should write out an HTML list of all the names in the csv, and output it to a file called "output_list.html". Make sure that you can open this file in your browser. Verify that it correctly display the numbered list of 10 names.



  2. Write a function makeHTMLTable. This function should read data from the name and wage file. This function should output all of the data to a new file as an html table.

    Your code should write out all the data in the csv as an html table, to a file called "output_table.html". Make sure that you can open this file in your browser. Verify that it correctly displays 4 columns and 11 rows.

    As a refresher on html tables: the following html will make a table with 3 columns and 2 rows. Again, I have indented/formatted it nicely for legibility, but HTML doesn't care about whitespace., if all your html was on a single line, it would still work.
    <table border="1">
    <tbody>
        <tr>
            <td>Color</td>
            <td>Lucky Number</td>
            <td>Vibe</td> 
        </tr>
        <tr>  
            <td>red</td>
            <td>12</td>
            <td>warm</td>  
        </tr>
    </tbody>
    </table>
    


    Bonus: use the <b> tag to bold the column names (i.e. the text in the first row of the table)

Example Code

Here is some python code that will generate an html file containing an ordered list:
names = ["Alice","Bob","Clara","Dave"]

html = "<ol>\n" # Note: newlines/whitespace is optional in html
for n in names:
    html += "<li>" + n + "</li>\n"
html += "</ol>"

f = open("output_list.html","w")
f.write(html)
f.close()