0
我有一個值爲unicode。它的數字是「4」。我需要將它與datetime.timedelta
的值"42 days, 9:46:21"
進行比較。如何將它們以相同的格式進行轉換,以進行比較還是減法?如何比較unicode和datetime.timedelta值?
在下面的代碼中,TimeDiffRestoCurrent是一個datetime.timedelta,SLA_Time是一個unicode字符串。
if TimeDiffRestoCurrent < SLA_Time:
print()
錯誤,我發現是:
if TimeDiffRestoCurrent < SLA_Time:
TypeError: can't compare datetime.timedelta to unicode