从python生成HTML [英] Generating HTML from python

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

问题描述




我希望用一种简单的方法从wxPython生成报告并感觉

wxHtmlEasyPrinting可能是一个很好的解决方案。


我现在需要生成HTML wxHtmlEasyPrinting可以打印:我需要

a标题后跟文本行看起来不太难看。如果可能的话我会想要使用现有模块。


Q1)是否有这样的模块?

Q2)是我的方法相当不错?


问候,


Philippe

Hi,

I wish to use an easy way to generate reports from wxPython and feel
wxHtmlEasyPrinting could be a good solution.

I now need to generate the HTML wxHtmlEasyPrinting can print: I need to have
a title followed by lines of text that do not look too ugly. If possible I
would like to use an existing module.

Q1) Is there such a module ?
Q2) Is my approach fairly good ?

Regards,

Philippe

推荐答案

PS:我正在查看格式化程序模块,它似乎与HTML

不知何故相关,但没有任何代码示例我有点丢失

Philippe C. Martin写道:
PS: I am looking at the formatter module which seems to be related to HTML
somehow, but without any code sample I''m a bit lost
Philippe C. Martin wrote:


我希望用一种简单的方法从wxPython生成报告并感觉
wxHtmlEasyPrinting可以是一个很好的解决方案。

我现在需要生成HTML wxHtmlEasyPrinting可以打印:我需要
有一个标题,后面跟着看起来不太难看的文字行。如果
可能我想使用现有的模块。

Q1)是否有这样的模块?
Q2)我的方法相当不错?
问候,

Philippe
Hi,

I wish to use an easy way to generate reports from wxPython and feel
wxHtmlEasyPrinting could be a good solution.

I now need to generate the HTML wxHtmlEasyPrinting can print: I need to
have a title followed by lines of text that do not look too ugly. If
possible I would like to use an existing module.

Q1) Is there such a module ?
Q2) Is my approach fairly good ?

Regards,

Philippe






您可以在reStructuredText中生成报告

格式(谷歌是你的朋友)然后转换

用HTML,PS,PDF等等。


Michele Simionato

You could generate your report in reStructuredText
format (Google is your friend) and then convert
them in HTML, PS, PDF, etc.

Michele Simionato


Am Thu,2005年6月9日12:43:19 +0000 schrieb Philippe C. Martin:
Am Thu, 09 Jun 2005 12:43:19 +0000 schrieb Philippe C. Martin:

wxHtmlEasyPrinting可能是一个很好的解决方案。

我现在需要生成HTML wxHtmlEasyPrinting可以打印
Hi,

I wish to use an easy way to generate reports from wxPython and feel
wxHtmlEasyPrinting could be a good solution.

I now need to generate the HTML wxHtmlEasyPrinting can print




我不知道wxPython,但生成HTML非常容易。


有人说混合HTML和编程代码并不好。


但是如果你想创建动态pa具有比HTML更多逻辑的ge

这是最好的解决方案。


示例:乘法表


rows = []

heading = []

我在范围内(1,11):

heading.append(''< th bgcolor =" grey">%s< / th>''%i)

cols = []

for j in range(1,11):

cols.append(''< td align =" right">%s< / td>''%(i * j))

row ='' < tr>< th bgcolor =" grey">%s< / th>%s< / tr>''%(i,''''。join(cols))

rows.append(row)

html ="""

< html>

< head>< title> ;乘法表< / title>< / head>

< body>

< table border =" 1">

< tr>

< th>& nbsp;< / th> %s

< / tr>

%s

< / table>

< / body> ;

< / html> """ %(''''。join(标题),''''。join(行))


我想这在大多数模板语言中看起来都比较丑陋。


HTH,

Thomas


-

ThomasGüttler, http://www.thomas-guettler.de/


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

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