Dive Into Python Python for experienced programmers |

## 4.11. Summary

Python provides you with a powerful tool, `sgmllib.py`, to manipulate HTML by turning its structure into an object model. You can use this tool in many different ways.

- parsing the HTML looking for something specific
- aggregating the results, like the URL lister
- altering the structure along the way, like the attribute quoter
- transforming the HTML into something else by manipulating the text while leaving the tags alone, like the `Dialectizer`

Along with these examples, you should be comfortable doing all of the following things:

- Using `locals`() and `globals`() to access namespaces
- Formatting strings using dictionary-based substitutions
- Using regular expressions. They are an important part of every programmer's toolkit, and they will play a larger role in future chapters.