AttributeError: module 'datetime' has no attribute 'now' ------解决方法之一

 1. 遇到的问题如下图:

2. 而相同的代码在shell中是可以执行成功的,如下图:

3. 原因:当前文件夹里含有datetime.py文件,覆盖了datetime 模块

4. 解决:把该文件改成其他名称就好

 

猜你喜欢

转载自www.cnblogs.com/wujiaqing/p/10811591.html
今日推荐