The output of my code is b'19.3882
. How do I convert this to show only the integer output of 19
.
I tried x=int(data)
but that doesn't work.
I also tried x=int(data.stdout)
but to no avail.
Thanks.
The output of my code is b'19.3882
. How do I convert this to show only the integer output of 19
.
I tried x=int(data)
but that doesn't work.
I also tried x=int(data.stdout)
but to no avail.
Thanks.
Try making it a float first? I assume it's python3.
>>> data = b'19.3882'
>>> int(data)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: b'19.3882'
>>> float(data)
19.3882
>>> int(float(data))
19