Python论坛  - 讨论区

标题:[python-chinese] 怎么用python写一个xml文件,最简单的那种,谢谢

2006年12月22日 星期五 15:32

lu_zi_2000 lu_zi_2000在163.com
星期五 十二月 22 15:32:03 HKT 2006





lu_zi_2000
2006-12-22
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20061222/fa39f6dd/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年12月22日 星期五 15:38

Zoom.Quiet zoom.quiet在gmail.com
星期五 十二月 22 15:38:18 HKT 2006

On 12/22/06, lu_zi_2000 <lu_zi_2000在163.com> wrote:
>
>
http://effbot.org/zone/element.htm
'''
# elementtree-example-1.py
from elementtree.ElementTree import Element, SubElement, dump
window = Element("window")

title = SubElement(window, "title", font="large")
title.text = "A sample text window"

text = SubElement(window, "text", wrap="word")

box = SubElement(window, "buttonbox")
SubElement(box, "button").text = "OK"
SubElement(box, "button").text = "Cancel"

dump(window)
'''

$ python elementtree-example-1.py
A sample text window



-- 
'''Time is unimportant, only life important!
blog@  http://blog.zoomquiet.org/pyblosxom/
wiki@    http://wiki.woodpecker.org.cn/moin/ZoomQuiet
douban@ http://www.douban.com/people/zoomq/
____________________________________
Please use OpenOffice.org to replace M$ office.
     http://zh.openoffice.org
Please use 7-zip to replace WinRAR/WinZip.
     http://7-zip.org/zh-cn/
You can get the truely Freedom from software.
'''

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年12月22日 星期五 16:08

lu_zi_2000 lu_zi_2000在163.com
星期五 十二月 22 16:08:40 HKT 2006

¶àл




lu_zi_2000
2006-12-22



·¢¼þÈË£º Zoom.Quiet
·¢ËÍʱ¼ä£º 2006-12-22 15:38:35
ÊÕ¼þÈË£º python-chinese在lists.python.cn
³­ËÍ£º 
Ö÷Ì⣺ Re: [python-chinese]ÔõôÓÃpythonдһ¸öxmlÎļþ£¬×î¼òµ¥µÄÄÇÖÖ£¬Ð»Ð»

On 12/22/06, lu_zi_2000  <lu_zi_2000在163.com > wrote:
>
>
http://effbot.org/zone/element.htm
'''
# elementtree-example-1.py
from elementtree.ElementTree import Element, SubElement, dump
window = Element("window")

title = SubElement(window, "title", font="large")
title.text = "A sample text window"

text = SubElement(window, "text", wrap="word")

box = SubElement(window, "buttonbox")
SubElement(box, "button").text = "OK"
SubElement(box, "button").text = "Cancel"

dump(window)
'''

$ python elementtree-example-1.py
 A sample text window       



-- 
'''Time is unimportant, only life important!
blog@  http://blog.zoomquiet.org/pyblosxom/
wiki@    http://wiki.woodpecker.org.cn/moin/ZoomQuiet
douban@ http://www.douban.com/people/zoomq/
____________________________________
Please use OpenOffice.org to replace M$ office.
     http://zh.openoffice.org
Please use 7-zip to replace WinRAR/WinZip.
     http://7-zip.org/zh-cn/
You can get the truely Freedom from software.
'''
_______________________________________________
python-chinese
Post: send python-chinese在lists.python.cn
Subscribe: send subscribe to python-chinese-request在lists.python.cn
Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
Detail Info: http://python.cn/mailman/listinfo/python-chinese
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20061222/66bfe7ec/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号