You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to robotframework-users
Good Day
I have a problem converting a number to 2 decimal points. For example: ${number1}= set variable ${1.3333} ${number1}= convert to number ${number1} 2
The result for ${number1} is 1.33 <-- correct
However if I put something like this: ${number1}= set variable ${0.0} ${number1}= convert to number ${number1} 2
I expect to get 0.00 but the result remains 0.0
Any response would be appreciated. Thank you
Laurent Bristiel
unread,
Dec 7, 2016, 6:11:03 PM12/7/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to robotframework-users
Hi,
this is the way Python works: it does not show trailing zeros. You can try this in Python: >>> 123.123000 123.123 >>> 0.0000 0.0
So, if you want to have trailing zeros anyway, you have to switch to strings and do something like: >>> "%.2f" % round(1.3333,2) '1.33' >>> "%.2f" % round(0.0,2) '0.00'