在 pythran 中使用日期时间

Use datetime in pythran

本文关键字:日期 时间 pythran      更新时间:2023-10-16

我正在使用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 页面上填写一个问题。