Outline for November 17, 2021
Reading
: §12, 13
Due
: Homework 4, due November 22, 2021
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
Matt Bishop
Office: 2209 Watershed Sciences
Phone: +1 (530) 752-8060
Email:
mabishop@ucdavis.edu
ECS 235A, Computer and Information Security
Version of November 18, 2021 at 2:21PM
You can also obtain a PDF version of this.