I thought I understood about python modules until I tried this
import datetime
datetime.now()
AttributeError Traceback (most recent call last)
in ()
1 import datetime
----> 2 datetime.now() AttributeError: 'module' object has no attribute 'now'
from datetime import *
datetime.now()
datetime.datetime(2013, 9, 13, 16, 35, 4, 433977)
from datetime import now
ImportError Traceback (most recent call last) in () ----> 1 from datetime import now ImportError: cannot import name now
My illusion of thinking I knew python modules dissipated immediately. I am using ipython notebook
Thanks
import datetime;print datetime.datetime.now()
– Ashwini Chaudharyimport datetime; now = datetime.datetime.now
- this allows you to just usenow()
. – Frerich Raabe