Outline for November 3, 2025
Reading:
§12.1–12.5, 13.1–13.5
Assignments:
Homework 3, due November 12, 2025
perm
done recursively
Reading a URL [
geturl.py
,
geturl2.py
,
geturl3.py
]
Opening a URL
Reading the page as a string
The role of
decode()
[
geturl-nd.py
]
SSL/TLS and python [
geturl-ssl.py
]
A program to print links in web pages [
urlpat.py
,
urlpat2.py
]
JSON [
json-ex.py
]
What it is
json.loads
json.dumps
What is XML?
Tree structure
Elements, tags, attributes, attribute values
Example:
sample1.xml
Python and XML [
basic-xml.py
]
xml.etree.ElementTree
Parsing the tree from file input (
ET.parse()
), from a string (
ET.fromstring()
)
Referring to elements
Accessing tag names, attributes
Finding nodes in the tree
Dumping, writing the tree
Removing an element and its descendants
Changing an element’s attribute
Setting attributes
Prettyprinting XML [
xmlpp.py
,
xmlpp-full.py
]
Matt Bishop
Office: 2209 Watershed Sciences
Phone: +1 (530) 752-8060
Email:
mabishop@ucdavis.edu
MHI 289I, Programming in Health Informatics
Version of November 2, 2025 at 11:12AM
You can also obtain a PDF version of this.