I am using lxml to objectify xml string with dashes in the tags. For example: After this step, the elements’ names come with dashes. I can’t access foo-foo due to dashes in the name. How can I remove dashes from tags name as well as from attribute names? Answer It’s hacky, but you could do something like this to transform