这是我在没有 HTML 代码时所做的
from collections import defaultdict
hello = ["hello","hi","hello","hello"]
def test(string):
bye = defaultdict(int)
for i in hello:
bye[i]+=1
return bye
我想将其更改为 html 表,这是我迄今为止尝试过的,但它仍然无法正常工作
def test2(string):
bye= defaultdict(int)
print"<table>"
for i in hello:
print "<tr>"
print "<td>"+bye[i]= bye[i] +1+"</td>"
print "</tr>"
print"</table>"
return bye