If you are using python >= 2.7, you can use total_seconds
:
hours = td.total_seconds() / 3600
If you are using python < 2.7, you can make your own total_seconds:
total_seconds = lambda td: (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6