python - 将 python xml 响应打印到 HTML 页面中
问题描述
我的 .py 应用程序从 API 返回 xml 响应,我想将 messageKey 'notFound' 的值写入 .html 页面。
回应前:
<response>
<returncode>FAILED</returncode>
<messageKey>notFound</messageKey>
<message>We could not find a meeting with that meeting ID</message>
</response>
.html 的 EX:
#....
<div class="row">
<p id="demo"></p>
</div>
#....
请问有什么帮助吗?
解决方案
我通过以下方式解决这个问题:
.py:
@flask.route('/admin')
def index():
return render_template("admin.html", variable=soup)
.html:
<div class="row">
<p>{{variable}}</p>
</div>
推荐阅读
- java - 无法使用代理运行电报机器人
- java - 应用程序从单体升级到微服务
- sql - 创建带有两个参数的返回多个记录的 Oracle 过程
- html - 无法在输入焦点上更改同级属性
- javascript - 如何正确过滤 yandex 地图上的数据?
- allen-sdk - Get more of the metadata from the Neurotransmitter study using Allen SDK
- excel - 单击单选按钮时如何触发数据验证?
- sql - SQL first_value() 按特定日期部分
- android - 首次安装时无法获取 IMEI 号码
- java - 我不能为 minecraft 或其他 java 应用程序分配超过 1GB 的内存我该怎么办,java 更新可能导致它