davey_dev davey_dev - 1 year ago 141
Python Question

RobotFramework Create Dictionary with an integer value instead of string

Create Dictionary sensor_id=1

when using Python gives me:

{'sensor_id': '1'}

Where really I want:

{'sensor_id': 1}

Is there anyway to prevent the robot framework from adding these quotes to my integer values?

Answer Source

In robot, you can coerce a string to an integer by putting it inside ${}

${foo}=  create dictionary    sensor_id=${1}

With the above, the value in the dictionary will be an integer.

For more information see Number Variables in the robot framework user guide.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download