我有以下代码将天数打印为“8 天,0:00:00”,我只想打印数字,输出应该只有“8”,任何人都可以提供有关如何执行此操作的输入吗?
from datetime import datetime, date
def main ():
cr_date = '2013-11-01'
curr_date = '2013-11-09 18:17:53.196126'
crdate = date(*map(int, cr_date.split("-")))
currdate = datetime.strptime(curr_date, "%Y-%m-%d %H:%M:%S.%f")
days = currdate.date() - crdate
print "DAYS: " + str(days)
if __name__ == '__main__':
main()