我正在使用Jython来调用一些Java代码。其中一个java方法返回Date。我如何得到一个python str?我有这个:(上下文是我发送到Jython的java对象)
emailDate = context.getSentEmail().getCreateDate()
log("Email date is:"+datetime.strftime(emailDate))
我收到此错误:
unbound method strftime() must be called with datetime instance as first argument (got java.util.Date instance instead) (execute) (PythonRunner.java:89)
我该怎么做?
更新
所以我添加了像这样的进口语句:
from time import time
import datetime
我现在收到此错误:
'module' object has no attribute 'strftime' (execute) (PythonRunner.java:89)