Outline for November 9, 2023
Reading:
§2, 13
Due:
Homework 3, due November 9, 2023
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:
[email protected]
ECS 235A, Computer and Information Security
Version of November 8, 2023 at 11:42PM
You can also obtain a PDF version of this.