module 'datetime' has no attribute 'now'的可能的一种解决方式

我报这个错:module 'datetime' has no attribute 'now',其原因为我导入包的时候写的是:import datetime

而调用的时候写的是datetime.now()   

其实应该写成datetime.datetime.now()

你可能感兴趣的:(python语法)