modules we have cut out few lines and reduced the indentation that is present in the file the file is about in sizeso we have compressed it using gzip to more manageable unfortunatelythe element tree parser requires either filename or file object to readbut we cannot give it the compressed file since that will just appear to be random binary data we can solve this problem with two initial stepsbinary gzip open(filenameread(fh io stringio(binary decode("utf ")io stringio the gzip module' gzip open(function is similar to the built-in open(except that it reads gzip-compressed files (those with extension gzas raw binary data we need the data available as file that the element tree parser can work withso we use the bytes decode(method to convert the binary data to string using utf- encoding (which is what the xml file uses)and we create file-like io stringio object with the string containing the entire xml file as its data tree xml etree elementtree elementtree(root tree parse(fhstations [for element in tree getiterator("station_name")stations append(element texthere we create new xml etree elementtree elementtree object and give it file object from which to read the xml we want it to parse as far as the element tree parser is concerned it has been passed file object open for readingalthough in fact it is reading string inside an io stringio object we want to extract the names of all the weather stationsand this is easily achieved using the xml etree elementtree elementtree getiterator(method which returns an iterator that returns all the xml etree elementtree element objects that have the given tag name we just use the element' text attribute to retrieve the text like os walk()we don' have to do any recursion ourselvesthe iterator method does that for us nor do we have to specify tag--in which case the iterator will return every element in the entire xml document other modules |we don' have the space to cover the nearly packages and modules that are available in the standard library nonethelessthis general overview should be sufficient to get flavor of what the library provides and some of the key packages in the major areas it serves in this section' final subsection we discuss just few more areas of interest in the previous section we saw how easy it is to create tests in docstrings and to run them using the doctest module the library also has unit-testing bytes type