Exercises, examples and other material relating to training module Y151. This topic is presented on public courses Learning to program in Python
, Python Programming
, Intermediate Python
An XML document is a structured piece of data, held as a piece of text. Python can be used to process XML data, a subject which is covered in this module.
|Articles and tips on this subject||updated|
|4710||Searching a Json or XML structure for a specific key / value pair in Python|
With data loaded from JSon or XML structures, you'll often want to search for attributes by element name - without having to code the structure, and with the code adapting itself to mean subtle structure changes in the suppied data.
Here's an example written during lat week's tailored Intermediate Python ...
|4594||XML handling in Python - a new teaching example using etree|
From the Python course just completed - a new example of XML handling, through the xml.etree.ElementTree module which was first available in Python 2.5.
import xml.etree.ElementTree as etree
tree = etree.parse(args.sourcefile)
|3082||XML handling in Python - SAX, DOM and XSLT examples|
XML is the "eXtensible Markup Language" ... a set of rules to which a language must adhere, rather than a complete language definition - you need to add other elements such as a DTD or Schema to complete the definition of a language that conforms to an XML standard.
How do you process XML, then?
It's incredible just how much time bookkeeping takes - small adjustments to the various resources we have, tidying up modules that are no longer relevant and pointing any visitors at replacements. There' been a lot of that going on over the last couple of days ... for example:
1. I have deleted two ...
|2506||Good example of recursion in Python - analyse an RSS feed|
I'm not keen on recursive code - code that calls itself. Very often, such code is elegant in a way, yet so 'clever' that it is hard to follow. There are, however, exceptions where I say "THAT is a good use of recursion". Once such is in the handling / parsing of RSS (Really Simple Syndication) feeds.
|2378||Handling XML in Perl - introduction and early examples|
There are hundreds of modules (literally) in Perl for handing XML. Some of them are highly specialised, but others are of much more general use in reading (and in some cases writing) XML streams.
(definition of XML: Extended Markup Language - a tagging system in plain text for marking up data; not ...
Examples from our training material
Some modules are available for download
as a sample of our material or under an Open Training Notes License
for free download from [here]
Topics covered in this module
Running Python on your Web Server.
Zope, Jython, Tkinter, XML, Database access.
Commonly used modules such as PyUnit.
Accessing Microsoft objects / ActivePython.
The Vaults of Parnassus, news groups and other sources.
If you are looking for a complete course and not just a information on a single subject, visit our Listing and schedule
Well House Consultants specialise in training courses in
. We run
throughout the UK (and beyond for longer courses), and
at our training centre in Melksham, Wiltshire, England.
It's surprisingly cost effective to come on our public courses -
even if you live in a different
country or continent to us
We have a technical library of over 700 books on the subjects on which we teach.
These books are available for reference at our training centre.