consider an xml file 'recipens xmlthat makes use of namespacesfamous guacamole southwest favoritelarge avocadoschopped combine all ingredients and hand whisk to desired consistency serve and enjoy with ice-cold beers to work with the namespacesit is usually easiest to use dictionary that maps the namespace prefix to the associated namespace uri you then use string formatting operators to fill in the uri as shown herefrom xml etree elementtree import elementtree doc elementtree(file="recipens xml"ns ' 'ingredients doc find('{%( ) }ingredientsnsfor item in ingredients findall('{%( ) }itemns)num item get('num'units item get('units',''text item text strip(quantity "% % (numunitsprint("%- % (quantitytext)for small xml filesit is fine to use the elementtree module to quickly load them into memory so that you can work with them howeversuppose you are working with huge xml file with structure such as thisa texas funeral jon wayne metaphysical graffiti the dead milkmen continues for more albums reading large xml file into memory tends to consume vast amounts of memory for examplereading mb xml file may result in an in-memory data structure of more than mb if you're trying to extract information from such filesthe easiest way to lib fl ff