Simple natural order sorting API for Python that just works
The natsort class in the naturalsort module is a very simple alternative to Python’s sorted() function that implements natural order sorting in Python.
Here’s an example of regular sorting vs. natural order sorting:
>>> # Import the sorted() alternative. >>> from natsort import natsort >>> >>> # This is plain old sorting (what we don't want). >>> sorted(['1', '5', '10', '50']) ['1', '10', '5', '50'] >>> >>> # This is version sorting (what we're after). >>> natsort(['1', '5', '10', '50']) ['1', '5', '10', '50'] >>> >>> # This covers a previously fixed bug. >>> natsort(['1.0', '1.5']) ['1.0', '1.5']
The latest version of naturalsort is available on PyPi and GitHub. For bug reports please create an issue on GitHub. If you have questions, suggestions, etc. feel free to send me an e-mail at email@example.com.
This software is licensed under the MIT license.
© 2013 Peter Odding.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size naturalsort-1.0.tar.gz (2.9 kB)||File type Source||Python version None||Upload date||Hashes View hashes|