Need Assistance with This Simple Python Code -
here code & error : attributeerror: type object 'datetime.datetime' has no attribute 'strptime
#trying calculate how many days until project due import datetime project = input('when project due please specify mm/dd/yyyy ') deadline = datetime.datetime.strptime(project, '%m/%d/y').date() days = project - deadline print(days) print(days.days)
thank in advance #koh
looks need this:
import datetime project = input('when project due for. please specify mm/dd/yyyy ') deadline = datetime.datetime.strptime(project, '%m/%d/%y').date() delta = deadline - datetime.datetime.now().date() print(delta.days)
using python3 there no errors datetime:
>>> datetime.datetime.strptime("08/11/2015", "%m/%d/%y").date() datetime.date(2015, 8, 11)
Comments
Post a Comment