Python print time as days and hours

Solution 1:

You could try something like this:

date_str = str(uptime)
days, times = date_str.split(", ")
result = days
times = times.split(":")
units = ["hours", "minutes", "seconds"]
for i, unit in enumerate(units):
    result += f", {times[i]} {unit}"
print(result)

Basically, I'm constructing the string manually here.