我需要在 sikuli 脚本中获取当前日期。我在我的脚本中使用下面的代码片段,其中 DATE 已被硬编码,并且需要每天更改以每天运行脚本。我试图在文档中找到,但在那里找不到。代码片段:
type(Key.TAB + "ABC" + Key.TAB + "06-17-2015" + Key.TAB + Key.TAB + Key.DOWN + Key.TAB + Key.TAB + Key.TAB)
我需要在 sikuli 脚本中获取当前日期。我在我的脚本中使用下面的代码片段,其中 DATE 已被硬编码,并且需要每天更改以每天运行脚本。我试图在文档中找到,但在那里找不到。代码片段:
type(Key.TAB + "ABC" + Key.TAB + "06-17-2015" + Key.TAB + Key.TAB + Key.DOWN + Key.TAB + Key.TAB + Key.TAB)
看看 Pythons time
,datetime
与 Sikuli 不兼容
例如:
import time
now = time.strftime('%c')
# Date
print ('Date: ' + time.strftime('%x'))
# Time
print('Current time: ' + time.strftime('%X'))
#Current date and time.
print ('Current time %s' % now )
更改"06-17-2015"
by time.strftime('%m-%d-%y')
。