任何python HTML生成器库? [英] Any python HTML generator libs?

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

问题描述

大家好。简单地说,我现在最需要的是一个python库来生成简单的HTML。


我现在使用XML来存储我的实验室报告记录。我发现python

非常方便操作XML,所以我想制作一个小的在线

CGI程序来帮助我的同事建立他们的实验室报告记录

到XML,用于存储,HTML显示(供其他人浏览)和搜索。


使用python的标准库,DOM对象可以实现XML

很容易存储和搜索,但对于HTML生成来说,这是一个非常令人头疼的问题。


我试图转向内联服务器端python脚本PSP(像asp和php一样的b $ b)而不是CGI。但是,由于报告数据总是非常复杂的数据结构,因此很难在线编写大部分内容。例如,预计PCR反应将以这种格式或类似方式显示在网络浏览器上:


PCR

样本:Sm1032

歌手:SullivanZ

TimeStamp:hh:mm mm-dd-yyyy

反应:

Reagent1:

名称:XXXX

浓度:XXXX mM

Volumn:XXX uL

Reagent2:

.........................

............ .......

由于

实验室报告中有数百个PCR反应和其他操作,因此 - 线PSP不是一个合适的解决方案。但直接用print语句编写HTML

是一件非常痛苦的事。


XSTL会有用吗?我的问题是否与XML-SIG有关?

期待您宝贵的建议。

Hi, everyone. Simply put, what I need most now is a python lib to
generate simple HTML.

I am now using XML to store my lab report records. I found python
really convinient to manipulate XML, so I want to make a small on-line
CGI program to help my colleagues to build their lab report records
into XML, for storage, HTML display (for others to browse) and search.

With python''s standard lib, the DOM object could realize the XML
storage and search quite easily, but for HTML generation, it is a
great headache.

I tried to turn to the in-line server-side python script PSP(something
like asp and php) instead of CGI. However, since the report data is
always of very complex data structures, it is really hard to write most
things in-line. For example, a PCR reaction is expected to be shown in
this format or alike on a web browser:

PCR
Sample: Sm1032
Operater: SullivanZ
TimeStamp: hh:mm mm-dd-yyyy
Reaction:
Reagent1:
Name:XXXX
Concentration:XXXX mM
Volumn:XXX uL
Reagent2:
.........................
.........................

Since there are hundreds of PCR reaction and other operations in the
lab report, in-line PSP is not a suitable solution. But writing HTML
directly with print statement is a great pain.

Will XSTL be useful? Is my problem somewho related with XML-SIG?
Looking forward to your precious suggestion.

推荐答案

XSTL会有用吗?我的问题是否与XML-SIG有关?
期待您宝贵的建议。
Will XSTL be useful? Is my problem somewho related with XML-SIG?
Looking forward to your precious suggestion.



XSLT功能强大,但是屁股中的王室痛苦。只需编写一些Python

来生成HTML就可能更容易了。


-

Michael McGlothlin, tech monkey

Tub Monkey
http://www.tubmonkey .com /


XSLT is powerful but a royal pain in the arse. Just writing some Python
to generate your HTML would probably be a lot easier for you.

--
Michael McGlothlin, tech monkey
Tub Monkey
http://www.tubmonkey.com/


Sullivan WxPyQtKinter napisa3(a):
Sullivan WxPyQtKinter napisa3(a):
大家好。简单地说,我现在最需要的是一个python库来生成简单的HTML。

我现在使用XML来存储我的实验室报告记录。我发现python
非常方便操作XML,所以我想制作一个小的在线CGI程序来帮助我的同事将他们的实验报告记录构建成XML,用于存储,HTML显示(供其他人浏览)和搜索。

使用python的标准库,DOM对象可以很容易地实现XML的存储和搜索,但对于HTML生成,它是a />非常头痛。
Hi, everyone. Simply put, what I need most now is a python lib to
generate simple HTML.

I am now using XML to store my lab report records. I found python
really convinient to manipulate XML, so I want to make a small on-line
CGI program to help my colleagues to build their lab report records
into XML, for storage, HTML display (for others to browse) and search.

With python''s standard lib, the DOM object could realize the XML
storage and search quite easily, but for HTML generation, it is a
great headache.




我使用HTMLTemplate + ElementTree组合从XML文件中的数据生成静态HTML文档

。其他方式可能是使用面向对象的XSL,

因为ll-xist经常被广告。


-

Jarek Zgoda
http://jpa.berlios.de/


Sullivan WxPyQtKinter写道:
Sullivan WxPyQtKinter wrote:
大家好。简单地说,我现在最需要的是一个python库来生成简单的HTML。

我现在使用XML来存储我的实验室报告记录。我发现python
非常方便操作XML,所以我想制作一个小的在线CGI程序来帮助我的同事将他们的实验报告记录构建成XML,用于存储,HTML显示(供其他人浏览)和搜索。

使用python的标准库,DOM对象可以很容易地实现XML的存储和搜索,但对于HTML生成,它是一个非常令人头痛的问题。

我试图转向内联服务器端python脚本PSP(像asp和php这样的东西)而不是CGI。但是,由于报告数据始终是非常复杂的数据结构,因此在线编写大多数内容确实很困难。例如,预计PCR反应将以这种格式或类似方式显示在网络浏览器上:

PCR
示例:Sm1032
Operater:SullivanZ
TimeStamp:hh:mm mm-dd-yyyy
反应:
Reagent1:
名称:XXXX
浓度:XXXX mM
Volumn:XXX uL Reagent2:
........................
............... .........

由于实验室报告中有数百个PCR反应和其他操作,因此在线PSP不是一个合适的解决方案。但直接用print语句编写HTML
是一件非常痛苦的事。

XSTL会有用吗?我的问题是否与XML-SIG有关?
期待您宝贵的建议。
Hi, everyone. Simply put, what I need most now is a python lib to
generate simple HTML.

I am now using XML to store my lab report records. I found python
really convinient to manipulate XML, so I want to make a small on-line
CGI program to help my colleagues to build their lab report records
into XML, for storage, HTML display (for others to browse) and search.

With python''s standard lib, the DOM object could realize the XML
storage and search quite easily, but for HTML generation, it is a
great headache.

I tried to turn to the in-line server-side python script PSP(something
like asp and php) instead of CGI. However, since the report data is
always of very complex data structures, it is really hard to write most
things in-line. For example, a PCR reaction is expected to be shown in
this format or alike on a web browser:

PCR
Sample: Sm1032
Operater: SullivanZ
TimeStamp: hh:mm mm-dd-yyyy
Reaction:
Reagent1:
Name:XXXX
Concentration:XXXX mM
Volumn:XXX uL
Reagent2:
........................
........................

Since there are hundreds of PCR reaction and other operations in the
lab report, in-line PSP is not a suitable solution. But writing HTML
directly with print statement is a great pain.

Will XSTL be useful? Is my problem somewho related with XML-SIG?
Looking forward to your precious suggestion.



带字符串替换的三引号字符串是您的朋友。尝试

写一些像:


results = {''secnum'':1,''type'':''string'' ,''color'':''blue''}


print""" \

< h1> Section%(secnum )s< / h1>

< p>类型%(类型)s的元素应该是彩色的%(颜色)s< / p>

"" " %结果


或者你可能想看一下HTMLgen模块。这是

旧,但仍然有用。


问候

Steve

-

Steve Holden +44 150 684 7255 +1 800 494 3119

Holden Web LLC / Ltd www.holdenweb.com

爱我,爱我的博客holdenweb.blogspot.com


The triple-quoted string with string substitution is your friend. Try
writing something(s) like:

results = {''secnum'': 1, ''type'': ''string'', ''color'': ''blue''}

print """\
<h1>Section %(secnum)s</h1>
<p>Elements of type %(type)s should be coloured %(color)s</p>
""" % results

Alternatively you might want to take a look at the HTMLgen module. It''s
old, but still usable.

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd www.holdenweb.com
Love me, love my blog holdenweb.blogspot.com


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

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