简单的XML到Python转换 [英] Simple XML-to-Python conversion

查看:74
本文介绍了简单的XML到Python转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找一种方法来简单地将一个小的
XML配置文件转换为Python数据结构。我遇到了gnosis

XML工具,但需要一个内置的选项来做类似的事情。


我对DOM以及除简单XML结构之外的任何知识都是

至多是最基本的。有没有一种简单的方法可以使用SAX处理程序将
属性和元素拉入Python列表/词典?

I''ve been searching high and low for a way to simply convert a small
XML configuration file to Python data structures. I came across gnosis
XML tools, but need a built-in option for doing something similar.

My knowledge of DOM and anything beyond simple XML structures is
rudimentary at best. Is there a simple way to use SAX handlers to pull
attributes and elements into Python lists/dictionaries?

推荐答案

ga********@gmail.com schrieb:
我一直在寻找一种方法来简单地将一个小的XML配置文件转换为Python数据结构。
I''ve been searching high and low for a way to simply convert a small
XML configuration file to Python data structures.




看一看在Amara( http://uche.ogbuji.net/tech/4Suite / amara /)


Lutz

-

pub 1024D / 6EBDA359 1999-09-20 Lutz Horn< lu ******* @ gmx.de>

密钥指纹= 438D 31FC 9300 CED0 1CDE A19D CD0F 9CA2 6EBD A359
http://purl.oclc.org/NET/lutz.horn
http://www.spreadfirefox.com/?q=user/register&r=200



Take a look at Amara (http://uche.ogbuji.net/tech/4Suite/amara/).

Lutz
--
pub 1024D/6EBDA359 1999-09-20 Lutz Horn <lu*******@gmx.de>
Key fingerprint = 438D 31FC 9300 CED0 1CDE A19D CD0F 9CA2 6EBD A359
http://purl.oclc.org/NET/lutz.horn
http://www.spreadfirefox.com/?q=user/register&r=200


Amara确实制作它可以轻松地将XML文档转换为
a Python结构。不幸的是,根据

网站,这个建议需要第三个

派对软件,Amara,_and_ 4Suite安装。


原因我不能指望用户拥有第三方工具是因为这个

工具将在没有互联网访问权限的安全实验室环境中使用。

要求管理员放置这些网络上用于安装用户的软件包就像要求GW说出一些半智能的东西。

Amara does indeed make it effortless to transform an XML document into
a Python structure. Unfortunately this suggestion requires the 3rd
party software, Amara, _and_ a 4Suite installation according to the
website.

The reason I can''t expect users to have 3rd party tools is because this
tool will be used in a secure lab environment without Internet access.
Asking the admins to place these software packages on the network for
users to install is like asking GW to say something semi-intelligent.


ga ******** @ gmail.com 写道:
ga********@gmail.com wrote:
Amara确实可以毫不费力地将XML文档转换为Python结构。不幸的是,根据
网站,这个建议需要第三方软件,Amara,_and_ 4Suite安装。

我不能指望用户拥有第三方工具是因为这个
工具将在没有Internet访问的安全实验室环境中使用。
要求管理员将这些软件包放在网络上供用户安装就像要求GW说些什么半智能。
Amara does indeed make it effortless to transform an XML document into
a Python structure. Unfortunately this suggestion requires the 3rd
party software, Amara, _and_ a 4Suite installation according to the
website.

The reason I can''t expect users to have 3rd party tools is because this
tool will be used in a secure lab environment without Internet access.
Asking the admins to place these software packages on the network for
users to install is like asking GW to say something semi-intelligent.




为什么不使用distutils安装你需要的任何其他软件包?那是'b $ b它的用途。大概你需要打包这个东西

无论如何要分发。


-

网站:www DOT jarmania FULLSTOP com



Why not use distutils to install any additional packages you need? That''s
what it''s there for. Presumably you''re going to need to package this thing
for distribution anyway.

--
Website: www DOT jarmania FULLSTOP com


这篇关于简单的XML到Python转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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