Python module functions used in unexpected ways
<p>Based on <a href="http://stackoverflow.com/questions/6209/split-a-string-ignoring-quoted-sections#6243">"Split a string by spaces in Python"</a>, which uses <em>shlex.split</em> to split a string with quotes smartly, I would be interested in hearing about other common tasks solved by non-obvious standard library functions.  </p>

<p>If this turns into <a href="http://www.doughellmann.com/projects/PyMOTW/" rel="nofollow">Module of The Week</a>, that's fine too.  </p>
