出于好奇,我知道可以在Python中完整打印出一个HTML网页,例如:
print 'Content-type: html\n\n'
print '<html>'
print '<head><title>My first Python CGI app</title></head>'
print '<body>'
print '<p>Hello, world!</p>'
print '</body>'
print '</html>'
是否也可以做一些类似PHP的事情?
答案 0 :(得分:0)
print """
<?php
$wtfs = array("what", "the", "freak", "is", "this", "shnitz");
echo "<ul>\n";
foreach($wtfs as $wtf) {
echo "<li>$wtf</li>\n";
}
echo "<li>???</li>\n";
echo "</ul>\n";
?>
"""