python:HTML编写器? [英] python: html writer?

查看:66
本文介绍了python:HTML编写器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用jquery,使用选择器技术很容易在另一个元素中插入一些元素,我想知道是否有任何python库可以用jquery做类似的事情,原因是我希望服务器端python程序产生静态页面,需要解析html并在其中插入一些东西。

With jquery it's very easy to insert some element inside another element using the selector technology, I am wondering if there is any python library that can do things similar with jquery, the reason is I want server side python program to produce the static pages, which needs to parse the html and insert something into it.

或者其他替代方法,根本不是python语言?

Or other alternative, not in python language at all?

编辑:要清楚,我想使用python编写以下程序:

To be clear, I want to use python to write below program:

h = html.parse('temp.html')
h.find('#idnum').html('<b>my html generated</b>')

h.close()


推荐答案

听起来像是 pyquery 与你正在寻找的非常相似。

It sounds like pyquery works very similarly to what you're looking for.

这篇关于python:HTML编写器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆