spacepy.toolbox.human_sort — SpacePy v0.1.5 Manual

### Navigation

- index
- modules |
- modules |
- next |
- previous |
- homepage|
- search|
- documentation »
- toolbox - Toolbox of various functions and generic utilities »

# spacepy.toolbox.human_sort

`spacepy.toolbox.` `human_sort`(l)

  Sort the given list in the way that humans expect. http://www.codinghorror.com/blog/2007/12/sorting-for-humans-natural-sort-order.html

  Parameters: | l : list list of objects to human sort
  Returns: | out : list sorted list

  Examples

      >>> import spacepy.toolbox as tb
      >>> dat = ['r1.txt', 'r10.txt', 'r2.txt']
      >>> dat.sort()
      >>> print dat
      ['r1.txt', 'r10.txt', 'r2.txt']
      >>> tb.human_sort(dat)
      ['r1.txt', 'r2.txt', 'r10.txt']

### Navigation

- index
- modules |
- modules |
- next |
- previous |
- homepage|
- search|
- documentation »
- toolbox - Toolbox of various functions and generic utilities »