robotframework的关键字create dictionary在值为Int类型时自动将其转换为字符串类型,怎么才能防止他自动转换
时间: 2023-04-02 14:02:09 浏览: 80
您可以使用Python内置的字典类型,将整数类型的值作为字典的值,这样就不会自动转换为字符串类型了。另外,您也可以自定义一个关键字,使用Python的类型判断函数来判断值的类型,从而避免自动转换的问题。
相关问题
robotframework的关键字create dictionary在值为Int类型时自动将其转换为字符串类型,怎么才能保留Int类型,请给出实例
您好,关于robotframework的create dictionary关键字,可以使用Python中的int()函数将字符串类型的值转换为整数类型,示例如下:
*** Test Cases ***
Example
${dict}= Create Dictionary key1 ${int(123)} key2 ${int(456)}
Log ${dict}
在上述示例中,使用了Python中的int()函数将字符串类型的值转换为整数类型,从而保留了Int类型。
您好,关于robotframework的create dictionary关键字,可以使用Python中的int()函数 报错Resolving variable '${int(123)}' failed: Variable '${int}' not found.将字符串类型的值转换为整数类型,示例如下: *** Test Cases *** Example ${dict}= Create Dictionary key1 ${int(123)} key2 ${int(456)} Log ${dict} 在上述示例中,使用了Python中的int()函数将字符串类型的值转换为整数类型,从而保留了Int类型。
您好,关于robotframework的create dictionary关键字,可以使用Python中的int()函数将字符串类型的值转换为整数类型,示例如下:
*** Test Cases ***
Example
${dict}= Create Dictionary key1 ${int(123)} key2 ${int(456)}
Log ${dict}
在上述示例中,使用了Python中的int()函数将字符串类型的值转换为整数类型,从而保留了Int类型。
相关推荐
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)