Skip to content

Instantly share code, notes, and snippets.

@kevinjqiu
Created October 31, 2015 18:12
Show Gist options
  • Save kevinjqiu/50bd98c2f0c35a750895 to your computer and use it in GitHub Desktop.
Save kevinjqiu/50bd98c2f0c35a750895 to your computer and use it in GitHub Desktop.
sum on timedelta
>>> a=[datetime.timedelta(1), datetime.timedelta(2)]
>>> sum(a)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'int' and 'datetime.timedelta'
>>> a[0]+a[1]
datetime.timedelta(3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment