XML Writer in wxPython

uche.ogbuji at gmail.com uche.ogbuji at gmail.com
Tue Feb 7 12:44:28 EST 2006


Tim Roberts wrote re using print to generate XML:
> def PrintAddress( last, first, address, city, state, zip ):
>     print "  <address>"
>     print "    <lastname>%s</lastname>" % last
>     print "    <firstname>%s</firstname>" % first
>     print "    <address1>%s</address1>" % address
>     print "    <city>%s</city>" % city
>     print "    <state>%s</state>" % state
>     print "    <zip>%s</zip>" % zip
>     print " </address>"
>
> print "<addresses>"
> for row in addressDatabase:
>     PrintAddress( row.last, row.first,
>        row.address, row.city, row.state, row.zip )
> print "</addresses>"

Just be sure you're well aware of all the issues:

http://www.xml.com/pub/a/2002/11/13/py-xml.html

See also:

http://www.ibm.com/developerworks/xml/library/x-think35.html

--
Uche Ogbuji                               Fourthought, Inc.
http://uche.ogbuji.net                    http://fourthought.com
http://copia.ogbuji.net                   http://4Suite.org
Articles: http://uche.ogbuji.net/tech/publications/




More information about the Python-list mailing list