I have a numpy binary array like this:

```
np_bin_array = [0 1 0 0 1 0 0 0 0 1 1 0 0 1 0 1 0 1 1 0 1 1 0 0 0 1 1 0 1 1 0 0 0 1 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]

```

It was 8-bit string characters of a word originally, starting from the left, with 0's padding it out.

I need to convert this back into strings to form the word again and strip the 0's and the output for the above should be 'Hello'.

Thanks for your help!
['https://Stackoverflow.com/questions/42297695', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7580607/']
You can firstly interpret the bits into an array, using [`numpy.packbits()`](https://docs.scipy.org/doc/numpy/reference/generated/numpy.packbits.html), then convert it to an array of bytes by applying [`bytearray()`](https://docs.python.org/3.6/library/functions.html#bytearray), then `decode()` it to be a normal string.

The following code

```
import numpy
np_bin_array = [0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
print(bytearray(numpy.packbits(np_bin_array)).decode().strip("\x00"))

```

gives

```
Hello

```
I got it working with this:

```
np_bin_array = [0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
yy=[]

yy_word=""

yy=np.packbits(np_bin_array)

for i in yy:
    if i:
        j = chr(i)

        yy_word += str(j)

print(yy_word)

```