The following code was recently suggested as an example of how the
datetime module could be used to solve a problem.  Not having access to
Python at work, I found
http://pythontutor.com/visualize.html
thinking it would allow me to "play with Python" when I have a free moment.

from datetime import datetime
start_date = datetime(year=2012, month=11, day=3)
print(start_date)

datestring = '10/11/2012'
experiment_date = datetime.strftime(datestring, '%d/%m/%Y')
print(experiment_date)

if experiment_date > start_date:
    print("Experiment_date comes after start_date.")
else:
    print("Expriment_date does not come after start_date.")

Does not complete because of:

"ImportError: _strptime not supported"

At first I thought perhaps strptime was a Python3 feature but both v2.7
and v3.2 result in the same ImportError.
Is the problem with http://pythontutor.com/visualize.html
?

Also, the leading underscore in the error message puzzles me.

According to
http://docs.python.org/library/datetime.html
"""classmethod datetime.strptime(date_string, format)"""
strptime should work.




_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to