pymel.util.reorder

static util.reorder(x, indexList=[], indexDict={})

Reorder a list based upon a list of positional indices and/or a dictionary of fromIndex:toIndex.

>>> l = ['zero', 'one', 'two', 'three', 'four', 'five', 'six']
>>> reorder( l, [1, 4] ) # based on positional indices: 0-->1, 1-->4
['one', 'four', 'zero', 'two', 'three', 'five', 'six']
>>> reorder( l, [1, None, 4] ) # None can be used as a place-holder
['one', 'zero', 'four', 'two', 'three', 'five', 'six']
>>> reorder( l, [1, 4], {5:6} )  # remapping via dictionary: move the value at index 5 to index 6
['one', 'four', 'zero', 'two', 'three', 'six', 'five']

Previous topic

pymel.util.refreshEnviron

Next topic

pymel.util.round

Core

Core Modules

Other Modules

This Page