Popular recipes tagged "timedelta"http://code.activestate.com/recipes/tags/timedelta/2011-10-06T14:06:54-07:00ActiveState Code RecipesConvert strings like '5d' and '60s' to timedelta objects (Python)
2011-10-06T14:06:54-07:00Dan McDougallhttp://code.activestate.com/recipes/users/4169722/http://code.activestate.com/recipes/577894-convert-strings-like-5d-and-60s-to-timedelta-objec/
<p style="color: grey">
Python
recipe 577894
by <a href="/recipes/users/4169722/">Dan McDougall</a>
(<a href="/recipes/tags/datetime/">datetime</a>, <a href="/recipes/tags/timedelta/">timedelta</a>).
</p>
<p>I wrote this little function for <code>[Gate One](http://vimeo.com/24857127)</code> (a web-based terminal emulator/SSH client)... It converts strings in the format of <num><character> into timedelta objects. It's not rocket science but maybe it'll save someone a few keystrokes :). Besides that, it comes with a really nice Sphinx-ready (reStructuredText) docstring with complete doctests.</p>