【问题标题】:How to embed python variable on html [closed]如何在html上嵌入python变量[关闭]
【发布时间】:2013-05-13 16:43:50
【问题描述】:

在 html 中嵌入 python 变量需要一些帮助。如果没有 django 或 webpy 之类的框架,我无法找到一种工作方式。

【问题讨论】:

  • “在html中嵌入python变量”是什么意思?
  • 这需要服务器端脚本。自然会想到像 Django 这样的框架和 MVC,因为它是做这种事情的常用方式。 HTML 不支持嵌入的 python 代码,反之亦然; python 处理 HTML。
  • 尝试过 cgi?它很无聊、陈旧且已弃用,但看起来像你想要的......
  • 这就是我嵌入的意思 //html side var //Python side var = 'Hello World'

标签: python python-2.7


【解决方案1】:

您可以独立于框架使用Django template language

阅读"The Django template language: For Python programmers",特别是"standalone mode" 部分,了解如何仅使用模板系统。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-06-06
    • 2018-08-04
    • 1970-01-01
    • 2023-03-27
    • 2016-06-10
    • 2016-08-08
    • 1970-01-01
    相关资源
    最近更新 更多