AttributeError when using “import dateutil” and “dateutil.parser.parse()” but no problems when using “from dateutil import parser”
问题 I was playing with the dateutil module in Python 2.7.3. I simply wanted to use: import dateutil dateutil.parser.parse("01-02-2013") But I got an error: AttributeError: 'module' object has no attribute 'parser' I checked what attributes dateutil does have: print dir(dateutil) # output: ['__author__', '__builtins__', '__doc__', '__file__', '__license__', # '__name__', '__package__', '__path__', '__version__'] The thing is, when I try to import parser from dateutil directly, it does seem to