How to slice range of array along a (a-priori unknown) axis?

Diez B. Roggisch nospam-deets at web.de
Wed Feb 4 09:49:50 EST 2004


This should work.

def el_remove_bcells(var, axis):
    if axis == 0:
       return var[1:-1]
    else:
      return eval("var[%s1:-1]" % ":," * axis)

--
Regards,

Diez B. Roggisch



More information about the Python-list mailing list