Outline for November 22, 2021

Reading: §13
Due: Homework 4, due November 22, 2021

  1. Python and XML [basic-xml.py]
    1. xml.etree.ElementTree
    2. Parsing the tree from file input (ET.parse()), from a strinwg (ET.fromstring())
    3. Referring to elements
    4. Accessing tag names, attributes
    5. Finding nodes in the treew
    6. Dumping, writing the tree
    7. Removing an element and its descendants
    8. Changing an element’s attribute
    9. Setting attributes

  2. Another example [basic-xml2.py]

  3. Example: prettyprinting XML [xmlpp.py]

  4. Classes and objects [cards.py, war.py]
    1. User-defined types (classes)
    2. Instantiate (create) new object (__init__)
    3. Objects and attributes
    4. Objects and methods
    5. Printing objects (__str__)

UC Davis sigil
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.

Valid HTML 4.01 Transitional Built with BBEdit Built on a Macintosh