我的HTML只输出了两列我有12个

时间:2017-06-17 08:31:18

标签: python html

我想输出十二列数据到表但我只需要两个我需要放入一个范围但不知道我的代码底部的哪个位置,因为我只得到前两列而是我的第一行是标题。

import csv
with open('bike_results.csv', newline='') as csvfile:
    reader = csv.reader(csvfile, delimiter=' ', quotechar='|')
    for row in reader:
        print(','.join(row))
bike_list = list(reader)

sorted(bike_list)

html_content = "<html><body><table><tr><td>" + bike_list[0][0] + "</td><td>" + bike_list[0][1] + "</td></tr>"
i=1
while i < len(bike_list):
    html_content += "<tr><td>{}</td><td>{}</td></tr>".format(bike_list[i][0],bike_list[i][1])
    i+=1
html_content += "</table></body></html>"

import webbrowser

f = open('bike_results.html','w')

message = html_content
f.write(message)
f.close()

webbrowser.open_new_tab('bike_results.html')

1 个答案:

答案 0 :(得分:0)

只需输入额外的字段?

#include <iostream>
using namespace std;

int main() 
{
int a, *test= &a;  // Why no error here?, is this to be read as:
                   // *(test=&a),too? If this is the case, why is the 
                   // priority of * here lower than in the code above?

return 0;
}