Преобразование массива в двоичный файл с использованием numpy binary_repr

# welcome to softhunt.net
# Python program explaining
# binary_repr() function
import numpy as np

arr = [12, -33 ]

print ("Input array : ", arr)

# binary representation of first array
# element without using width parameter
ans = np.binary_repr(arr[0])
print ("Binary representation of 12 Without using width parameter : ", ans)

# binary representation of first array
# element using width parameter
ans = np.binary_repr(arr[0], width = 7)
print ("Using width parameter: ", ans)


# binary representation of 2nd array
# element without using width parameter
ans = np.binary_repr(arr[1])
print ("Binary representation of -33 Without using width parameter : ", ans)

# binary representation of 2nd array
# element using width parameter
ans = np.binary_repr(arr[1], width = 7)
print ("Using width parameter : ", ans)
Outrageous Ostrich