I want to prompt the user to enter the date dd/mm/year and use this later as part of filename and later as object in file(if this helps searching). Does using datetime ensure that user input will be a valid input? I would like the output to be year-mm-dd
My below version errors.
#This doesn't error but also doesn't prompt me for input.
from datetime import date def ObtainDate(): input = raw_input("Type Date dd/mm/year: ") d = datetime.strptime(input, "%y-%m-%d") print ObtainDate