Outline for November 22, 2021
Reading
: §13
Due
: Homework 4, due November 22, 2021
Python and XML [
basic-xml.py
]
xml.etree.ElementTree
Parsing the tree from file input (
ET.parse()
), from a strinwg (
ET.fromstring()
)
Referring to elements
Accessing tag names, attributes
Finding nodes in the treew
Dumping, writing the tree
Removing an element and its descendants
Changing an element’s attribute
Setting attributes
Another example [
basic-xml2.py
]
Example: prettyprinting XML [
xmlpp.py
]
Classes and objects [
cards.py
,
war.py
]
User-defined types (classes)
Instantiate (create) new object (
__init__
)
Objects and attributes
Objects and methods
Printing objects (
__str__
)
Matt Bishop
Office: 2209 Watershed Sciences
Phone: +1 (530) 752-8060
Email:
mabishop@ucdavis.edu
ECS 235A, Computer and Information Security
Version of November 22, 2021 at 9:14PM
You can also obtain a PDF version of this.