def getdim(lsp):
    '''
    Obtain the dimensionality of a .lsp file. This should work for all well
    formatted .lsp files.

    Parameters:
    -----------
       lsp      : .lsp string

    Returns a list of dimensions.
    '''
    dims= ['x','y', 'z'];
    rxs = ['{}-cells *([0-9]+)'.format(x) for x in ['x','y','z']];
    return [
        x for x,rx in zip(dims,rxs)
        if re.search(rx,lsp) and int(re.search(rx,lsp).group(1)) > 0 ];
def getdim ( lsp ) : dims = [ 'x' , 'y' , 'z' ] ; rxs = [ '{}-cells *([0-9]+)' . format ( x ) for x in [ 'x' , 'y' , 'z' ] ] ; return [ x for x , rx in zip ( dims , rxs ) if re . search ( rx , lsp ) and int ( re . search ( rx , lsp ) . group ( 1 ) ) > 0 ] ;
Obtain the dimensionality of a .lsp file. This should work for all well
    formatted .lsp files.

    Parameters:
    -----------
       lsp      : .lsp string

    Returns a list of dimensions.