[英]How to tell if a variable is a string or a list, or etc in SIkuli?
我想检查变量是否是字符串或列表,或者Sikuli中的其他变量? 我的意思是当前在IDLE中使用的变量。
通常在Python中,您可以使用type(varName)
确定变量类型。 但是,Sikuli将type()
用于不同的目的,因此应使用另一种方法。 没有什么选择。
isinstance()
。 matches.__class__
[]
打印-即列表, {}
-字典等,则... 例:
>>> lst1 = ['a', 'b', 'c']
>>> isinstance(lst1, list)
True
>>> lst1.__class__
<type 'list'>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.