经常在python中因为日期而google,在此做个小笔记.
>>>import datetime >>> a = datetime.date.today() >>> b = datetime.datetime(2014,11,01) >>> print a 2015-01-29 >>> print b 2014-11-01 >>> print (a-b).days 89
经常在python中因为日期而google,在此做个小笔记.
>>>import datetime >>> a = datetime.date.today() >>> b = datetime.datetime(2014,11,01) >>> print a 2015-01-29 >>> print b 2014-11-01 >>> print (a-b).days 89