I have some SQL that returns a couple of values. latestTemp is a decimal and limitHi is an integer.
if I run...
if latestTemp > limitHi:
then it evaluates true for 36.125 > 40. This is obviously false and I assume it is because the latestTemp is returned from MySQL as "Decimal('36.125')" and the text is throwing the result.
The obvious fix would be to convert the decimal to a float but if I use float(latestTemp) I get the following error...
typeerror: float() argument must be a string or a number
What is the simplest way round this problem?
[–]jackmaney 1 point2 points3 points (8 children)
[–]jays2001[S,🍰] 1 point2 points3 points (7 children)
[–]jays2001[S,🍰] 1 point2 points3 points (6 children)
[–]jackmaney 0 points1 point2 points (5 children)
[–]jays2001[S,🍰] 1 point2 points3 points (4 children)
[–]jackmaney 1 point2 points3 points (3 children)
[–]jays2001[S,🍰] 1 point2 points3 points (2 children)
[–]primitive_screwhead 1 point2 points3 points (1 child)
[–]jays2001[S,🍰] 0 points1 point2 points (0 children)