d={'yindi':99,'huyu':80,'miaonin':88,'lihan':40}
def libiao(name,score):
if score<60:
return'<tr><td>%s</td><td style="color red">%s</td><tr>'%(name,score)
return'<tr><td>%s</td><td>%s</td></tr>'%(name,score)
tds=[libiao(name,score) for name,score in d.iteritems()]
print'<table border="1">'
print'<tr><th>name</th><th>score</th><tr>'
print'\n'.join(tds)
print'</table>'
错误原因:exec(compile(f.read(), filename, 'exec'), namespace)
File "D:/python/biaoge.py", line 13
print'<table border="1">'
^
SyntaxError: invalid syntax
>>>
人笨嫌刀钝
相关分类