【问题标题】:How to check variable type using “type” function in Sikuli如何使用 Sikuli 中的“类型”功能检查变量类型
【发布时间】:2013-05-14 20:10:51
【问题描述】:

Sikuli 有自己的打字功能type。有没有办法调用python(jython)函数type?模块 builtins 无法导入。当然我可以使用 isinstance 代替,但我只是好奇是否有可能超出 Sikuli 范围并调用不是“覆盖”的 python 内置 type 函数。我用的是斯库力 r930。

#import builtins                         #ImportError: No module named builtins
findAll("1369036502514.png")
matches = getLastMatches()
print(isinstance(matches,Finder))        #returns TRUE
type("1369035684637.png",'hello world')  #types characters 
type('hello world again')                #types characters 
print(type(matches))                     #TypeError: type(): 1st arg can't be coerced to String

运行 builtins.type 也会导致失败:

builtins.type(matches)
NameError: name 'builtins' is not defined

__builtins__.type(matches)
NameError: name '__builtins__' is not defined

【问题讨论】:

标签: python jython sikuli built-in


【解决方案1】:

您可以使用matches.__class__

【讨论】:

    猜你喜欢
    • 2021-01-13
    • 2011-04-12
    • 2011-04-28
    • 1970-01-01
    • 2018-03-21
    • 1970-01-01
    • 2013-05-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多