Skip to content

Tag: element

Output Common Elements of Two Lists using Sets

I’d like to write a function definition that takes two lists and returns a single set with the values that each list has in common. Formally, here are some assertions I’d like to pass: Here’s the code I’m having trouble with: I receive an error output that I know has to do with strings and […]

Python Element Tree Writing to New File

Hi so I’ve been struggling with this and can’t quite figure out why I’m getting errors. Trying to export just some basic XML into a new file, keeps giving me a TypeError. Below is a small sample of the code Answer The ElementTree.write method defaults to us-ascii encoding and as such expects a file opened for writing binary: The output