【发布时间】:2015-06-02 08:11:34
【问题描述】:
a = {}
if type(a) == dict:
#read using dictionary keys.
else:
#treat it as a list
如何将 python 代码迁移到机器人框架。我试过了,
${type_obj}= Evaluate type(${a})
${type_bool}= Evaluate ${type_obj} == dict
Run Keyword If ${type_bool}==1 DictHandler
Run Keyword If ${type_bool}==0 ListHandler
但它只是因为语法错误而中断,
Evaluating expression '<type 'dict'> == dict' failed: SyntaxError: invalid syntax (<string>, line 1)
问题是,机器人将 python 的 dict 关键字视为字符串。那么,如何检查机器人内部变量的类型呢?
【问题讨论】: