How to check variable type using “type” function in Sikuli

风格不统一 提交于 2019-12-24 00:58:27

问题


Sikuli has its own function type for typing. Is there any way to invoke python (jython) function type? Module builtins can’t be imported. Of course I can use isinstance instead but I am just curious if it is possible to come outside Sikuli scope and invoke not “overridden”, python built-in type function. I use Sikuli 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

Running builtins.type results in failure too:

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

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

回答1:


You can use matches.__class__.



来源:https://stackoverflow.com/questions/16646636/how-to-check-variable-type-using-type-function-in-sikuli

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!