1
3
4 attributes_str = " ".join([ "%s=\"%s\"" %(x[0],x[1]) for x in attributes ])
5 th_str = "<tr>%s</tr>" %"".join([ "<th>%s</th>" %x for x in columns ])
6 return "<table %s>%s" %(attributes_str,th_str)
7
8
11
13
14 if rowIDs is None:
15 rowIDs = [ x for x in xrange(len(values)) ]
16
17 data_str = "".join([ "<tr rowID=\"%s\">%s</tr>" %(rowIDs[current_row_index],"".join([ "<td>%s</td>" %str(current_column).replace("&","").replace("<","").replace(">","") for current_column in values[current_row_index] ])) for current_row_index in xrange(len(values)) ])
18 return data_str
19
21 """
22 "columns" must be a list with column headers
23 """
24
25 if rowIDs is None:
26 rowIDs = [ x for x in xrange(len(values)) ]
27
28 attributes_str = " ".join([ "%s=\"%s\"" %(x[0],x[1]) for x in attributes ])
29
30 th_str = "<tr>%s</tr>" %"".join([ "<th>%s</th>" %x for x in columns ])
31 data_str = "".join([ "<tr rowID=\"%s\">%s</tr>" %(rowIDs[current_row_index],"".join([ "<td>%s</td>" %str(current_column).replace("&","").replace("<","").replace(">","") for current_column in values[current_row_index] ])) for current_row_index in xrange(len(values)) ])
32 return "<table %s>%s%s</table>\n" %(attributes_str,th_str,data_str)
33
34
36 """
37 """
38 if columns is not None:
39 to_print = ["\t".join(columns)]
40 else:
41 to_print = []
42
43 to_print.extend(values)
44
45 return "%s\n" %"\n".join( [ "\t".join(map(str,x)) for x in values ] )
46