1
我試圖在Google App Engine應用程序中創建一個表格,表格中的背景顏色會根據輸入定期更改。有誰知道如何做到這一點? 這裏是我的代碼:Google App Engine Python HTML表
self.response.out.write("""
<img src="/images/resistor.png" width = "150">
<table border = "1">
<tr height="150" >
<td bgcolor="%s" width="35"> </td> <td bgcolor="%s" width="35"> </td> <td bgcolor="%s" width="35"> </td> <td bgcolor="%s" width="35"> </td> %(Red,Blue,Black,Green)
</tr>
</table>
<form action="/sign" method="post">
<div><textarea name="content" rows="3" cols="60"></textarea></div>
<div><input type="submit" value="Sign Guestbook"></div>
</form> """)
self.response.out.write('</pre></body></html>')
例如紅色,綠色......在顏色%()將變量將在一個點,從而改變它們都可以是紅色或藍色和黃色。
謝謝你的幫助,但我得到錯誤文件「/Users/ben/Desktop/theresistorpage/main.py」,第116行,後 「」「.format(('Red','藍色','黑色','綠色'))) IndexError:元組索引超出範圍 – ben 2013-03-13 23:36:23
沒關係,我不小心加了一個括號,謝謝!!! – ben 2013-03-13 23:37:53
非常歡迎。 – bernie 2013-03-13 23:39:12