问题
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