我將應用程序從cgi移動到web.py.我得到了結果,並通過cgi中的簡單打印語句動態打印它們。所以結果在頁面完成加載之前已經打印出來了。在web.py中,我有一個return語句,但無法弄清楚如何實現這一點。web.py中的動態打印
樣品CGI代碼:
print "<p><b>Displaying Search Results</b></p>"
print "<table>"
cmd = subprocess.Popen(["find", location ,"-name", fileName], stdout=subprocess.PIPE)
for line in cmd.stdout:
tableData=line.rstrip("\n")
tableRow="<tr><td>tableData</td></tr>"
print tableRow
print "</table>"
,因爲它是生成上述代碼將在一次打印一行。如何爲web.py編寫相同的代碼?
非常感謝!!!!正是我在找什麼! – StuckAgain