在开始打印所需的行之前,输出一些HTML以设置适当的表结构.
找到要打印的行时,以HTML表格格式输出.
# begin the table
print("
# column headers
print("
")print("
Week")print("
Opp")print("
ACscr")print("
OPPscr")print("
Location")print("")
infile = open("Crushers.csv","r")
for line in infile:
row = line.split(",")
age = row[0]
week = row [1]
opp = row[2]
ACscr = row[3]
OPPscr = row[4]
location = row[5]
if age == 'U12':
print("
")print("
%s" % week)print("
%s" % opp)print("
%s" % ACscr)print("
%s" % OPPscr)print("
%s" % location)print("
")# end the table
print("
")