def convert_to_html(txt, num=-1):
    """
    Convert a line of a csv file to a line of an html table
    :param txt: a String containing a line from a csv file
    :param num: an integer identifying which line this is (starting at 0)
    :return this_line: A line of an html table equivalent to txt
    """
    this_line = '<tr>'

    # line zero is assumed to be header row
    if num == 0:
        tag = '<th>'
        end_tag = '</th>'
    else:
        tag = '<td>'
        end_tag = '</td>'

    # put content of txt between html tags
    while ',' in txt:
        com_pos = txt.index(',')
        segment = txt[:com_pos]
        this_line += tag + segment + end_tag
        txt = txt[com_pos + 1:]
    this_line += tag + txt.strip() + end_tag + '</tr>'

    return this_line