//在“Content-type...”声明之后...
print """<html>\
<head>
<title>Create Survey</title>
<link href="styles.css" type="text/css" rel="stylesheet">
</head>
<body>...."""
最佳答案
假设您正在使用 CGI 之类的东西根据 Web 请求“打印”文本,您应该依赖您的 Web 服务器(例如 Apache)根据 CSS 文件所在的位置将内容“打印”回请求客户端位于 htdocs 目录中。
但是,如果您只是想在命令行窗口中输出一些内容,您可以...
print file('/path/to/your/file/styles.css').read()
关于python - 在 Python 中,我可以将 HTML 打印到浏览器,我如何确保与其相关的 CSS 也得到 "printed",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22828355/