4

I am trying to convert a list of floating point number to bytearray and convert it back to original list. My list looks like this: [-0.055999, -0.054000, -0.049, -0.040999, -0.037000]

I am trying to use bytearray(list) but only accepts integers.

Any help is appreciated.

  • Is there a particular reason you're trying to do this? To (not really) answer your question, you can't do what you're trying to do. The allowed inputs of `bytearray` can be seen here: https://docs.python.org/3/library/functions.html#func-bytearray As you can see, an iterable of floats (and floats more generally) is not valid inputs. – PMende Aug 03 '18 at 23:41
  • Maybe this could help you. [Converting a float to bytearray](https://stackoverflow.com/a/36894176/8743158) – Anthony Aug 04 '18 at 01:17

0 Answers0