我正在使用 pythran,一个 Python 到 c++ 的编译器 http://pythran.readthedocs.io/
我们可以使用日期时间或任何其他方式在 pythran 函数中使用日期或时间信息吗?:
from datetime import datetime
print datetime.now()
我得到:
$ pythran ccompile.py
ccompile.py None None
CRITICAL I am in trouble. Your input file does not seem to match
Pythran's constraints...
E: Attribute 'now' unknown (ccompile.py, line 13)
最佳答案
pythran 不支持 datetime
模块,这可以从错误消息中推断出来。解决方法是:
- 从 python 代码调用
datetime
并将结果传递给 pythranized 函数 - 在 github page 上填写问题项目的。
关于python - 在 pythran 中使用日期时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35289562/