title: How to convert a timedelta to a string and back again
body: <p>Dateutil's <code>timedelta</code> object appears to have a custom <code>__str__</code> method:</p>
  
  <pre><code>In [1]: from datetime import timedelta
  
  In [2]: td = timedelta(hours=2)
  
  In [3]: str(td)
  Out[3]: '2:00:00'
  </code></pre>
  
  <p>What I'd like to do is re-create a <code>timedelta</code> object from its string representation. As far as I can tell, however, the <code>datetime.parser.parse</code> method will always return a <code>datetime.datetime</code> object (cf. <a href="https://dateutil.readthedocs.io/en/stable/parser.html" rel="noreferrer">https://dateutil.readthedocs.io/en/stable/parser.html</a>):</p>
  
  <pre><code>In [4]: import dateutil.parser
  
  In [5]: dateutil.parser.parse(str(td))
  Out[5]: datetime.datetime(2016, 11, 25, 2, 0)
  </code></pre>
  
  <p>The only way I see now to do this is to, in the parlance of <a href="https://stackoverflow.com/questions/2119472/convert-a-timedelta-to-days-hours-and-minutes">Convert a timedelta to days, hours and minutes</a>, 'bust out some nauseatingly simple (but verbose) mathematics' to obtain the seconds, minutes, hours, etc., and pass these back to the <code>__init__</code> of a new <code>timedelta</code>. Or is there perhaps a simpler way?</p>