xxxxxxxxxx
# welcome to softhunt.net
import numpy as np
softhunt = np.array((0, 0, 0, 0, 1, 3, 5, 7, 0, 9, 0, 11, 0, 0))
# without trim parameter
# returns an array without any leading zeros
res = np.trim_zeros(softhunt, 'f')
print(res)
xxxxxxxxxx
# welcome to softhunt.net
import numpy as np
softhunt = np.array((0, 0, 0, 0, 1, 3, 5, 7, 0, 9, 0, 11, 0, 0))
# without trim parameter
# returns an array without leading and trailing zeros
res = np.trim_zeros(softhunt)
print(res)
xxxxxxxxxx
# welcome to softhunt.net
import numpy as np
softhunt = np.array((0, 0, 0, 0, 1, 3, 5, 7, 0, 9, 0, 11, 0, 0))
# without trim parameter
# returns an array without any leading zeros
res = np.trim_zeros(softhunt, 'b')
print(res)