我想使用日期时间模块 utcfromtimestamp 方法,但它在 Ninja 中不起作用-IDE
I want to use datetime modul utcfromtimestamp method but its not work in Ninja-IDE
我想使用 datetime
模块 utcfromtimestamp
方法,但它在 Ninja-IDE 中不起作用。我该如何解决我的问题?
我的代码:
#-*- coding: utf-8 -*-
import datetime
print (datetime.datetime.utcfromtimestamp(130130301))
而 Ninja-IDE 2.3 写了这个错误信息:
File "C:\Users\test\Desktop\datetime.py", line 3, in <module>
print (datetime.datetime.utcfromtimestamp(130130301))
AttributeError: 'module' object has no attribute 'utcfromtimestamp'
我安装了 Python 3.4 并在首选项中设置了路径。
您将文件命名为 datetime.py
,并且 Python 导入了它而不是标准库 datetime
:
File "C:\Users\test\Desktop\datetime.py", line 3, in <module>
# ^^^^^^^^
所以第一个 datetime
是您的模块,第二个 datetime
是您模块中引用自身的全局变量,而您的模块本身没有 utcfromtimestamp
全局变量。
将您的文件重命名为其他名称。
我想使用 datetime
模块 utcfromtimestamp
方法,但它在 Ninja-IDE 中不起作用。我该如何解决我的问题?
我的代码:
#-*- coding: utf-8 -*-
import datetime
print (datetime.datetime.utcfromtimestamp(130130301))
而 Ninja-IDE 2.3 写了这个错误信息:
File "C:\Users\test\Desktop\datetime.py", line 3, in <module>
print (datetime.datetime.utcfromtimestamp(130130301))
AttributeError: 'module' object has no attribute 'utcfromtimestamp'
我安装了 Python 3.4 并在首选项中设置了路径。
您将文件命名为 datetime.py
,并且 Python 导入了它而不是标准库 datetime
:
File "C:\Users\test\Desktop\datetime.py", line 3, in <module>
# ^^^^^^^^
所以第一个 datetime
是您的模块,第二个 datetime
是您模块中引用自身的全局变量,而您的模块本身没有 utcfromtimestamp
全局变量。
将您的文件重命名为其他名称。