亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

實現可多樣化,這樣居然不讓通過

d = { 'Adam': 90, 'Lisa': 55, 'Bart': 59 }

def generate_tr(name, score):

? ? if score < 60:

? ? ? ? score = '<font color="red">%s</font>' % score

? ? return '<tr><td>%s</td><td>%s</td></tr>' % (name, score)


tds = [generate_tr(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>'

#可以在generate_rt()函數里判斷score然后重新賦值score

正在回答

1 回答

雖然多樣化,但是它要求用css style 屬性。這就沒辦法了

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
初識Python
  • 參與學習       758396    人
  • 解答問題       8967    個

學python入門視頻教程,讓你快速入門并能編寫簡單的Python程序

進入課程

實現可多樣化,這樣居然不讓通過

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號