python 'datetime.timedelta' object has no attribute 'total_seconds',,一段在本地正常运行的代码
python 'datetime.timedelta' object has no attribute 'total_seconds',,一段在本地正常运行的代码
一段在本地正常运行的代码在服务器上报错python 'datetime.timedelta' object has no attribute 'total_seconds', 经查发现是python2.6的timedelta类没有total_seconds()方法, 此方法在python2.7才添加上。
可以使用timedelta的seconds和days方法来获得时间段大小
total_seconds = td.seconds + 24*3600*td.days
相关内容
- python实现socket server,pythonsocket,import socke
- python调用os.exit()方法来终止进程,pythonos.exit,def outahe
- python __setattr__ 和 __dict__方法,__setattr___dict_,class acces
- Python list根据下标删除元素,pythonlist,python list的
- python错误重定向和终止进程,python重定向终止,import s
- Function defined outside the class,definedoutside,def f1(self,
- python类继承dict,python继承dict,class defaul
- Class operator add: instance + noninstance and noninstance + instance,
- Python类成员变量示例,python变量示例,class C1:
- python的getter和setter方法示例,gettersetter,class Cost_e
评论关闭