ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 用Python解析XML(1)

用Python解析XML(1)

原创 Linux操作系统 作者:jieforest 时间:2012-07-23 00:54:30 0 删除 编辑
One of the common tasks I am given in my day job is to take some data format input and parse it to create a report or some other document. Today we'll look at taking some XML input, parsing it with the Python programming language and then creating a letter in PDF format using Reportlab, a 3rd party package for Python. Let's say my company receives an order for three items that I need to fulfill.
The XML for that could look like the following code:

CODE:

01.
02.
03.456789
04.789654
05.John Doe
06.123 Dickens Road
07.Johnston, IA 55555
08.
09.
10.
11.11123
12.Expo Dry Erase Pen
13.1.99
14.5
15.

16.
17.22245
18.Cisco IP Phone 7942
19.300
20.1
21.

22.
23.33378
24.Waste Basket
25.9.99
26.1
27.

28.

29.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/301743/viewspace-736308/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 用PHP实现两路SMS
下一篇: 用Python解析XML(2)
请登录后发表评论 登录
全部评论

注册时间:2008-04-23

  • 博文量
    443
  • 访问量
    508609