Berman Berman - 1 year ago 86
Python Question

How to get rid of \x00 in my array of bytes?

Here is the example of my array:


is there any way to get rid of all the null characters? Any kind of replacing isn't the solution because the other symbols start with

Answer Source

Decode it to text. Or open the file with the correct encoding in the first place.

>>> b'[\x00{\x00"\x00s\x00u\x00b\x00'.decode('utf-16le')
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download