diff options
author | Seth Morton <seth.m.morton@gmail.com> | 2020-11-17 23:15:18 -0800 |
---|---|---|
committer | Seth Morton <seth.m.morton@gmail.com> | 2020-11-17 23:29:18 -0800 |
commit | 3f5439cbc2d5caab514a9d6053d7359e9f3c05eb (patch) | |
tree | 5c9a25689cfef4d16b0b1356b2fcc3cd8db95a76 /README.rst | |
parent | cde07bbcb24a95b5ef5b5796ab870020b9b8a163 (diff) | |
download | natsort-3f5439cbc2d5caab514a9d6053d7359e9f3c05eb.tar.gz |
Documentation updates
Diffstat (limited to 'README.rst')
-rw-r--r-- | README.rst | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -101,6 +101,7 @@ Quick Examples -------------- - `Sorting Versions`_ +- `Sort Paths Like My File Browser (e.g. Windows Explorer on Windows)`_ - `Sorting by Real Numbers (i.e. Signed Floats)`_ - `Locale-Aware Sorting (or "Human Sorting")`_ - `Further Customizing Natsort`_ @@ -128,6 +129,30 @@ conforms to a scheme like this, then it will work out-of-the-box with If you need to versions that use a more complicated scheme, please see `these examples <https://natsort.readthedocs.io/en/master/examples.html#rc-sorting>`_. +Sort Paths Like My File Browser (e.g. Windows Explorer on Windows) +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +Prior to ``natsort`` version 7.1.0, it was a common request to be able to +sort paths like Windows Explorer. As of ``natsort`` 7.1.0, the function +``os_sorted`` has been added to provide users the ability to sort +in the order that their file browser might sort (e.g Windows Explorer on +Windows, Finder on MacOS, Dolphin/Nautilus/Thunar/etc. on Linux). + +.. code-block:: python + + import os + from natsort import os_sorted + print(os_sorted(os.listdir())) + # The directory sorted like your file browser might show + +Output will be different depending on the operating system you are on. + +For users **not** on Windows (e.g. MacOS/Linux) it is **strongly** recommended +to also install `PyICU <https://pypi.org/project/PyICU>`_, which will help +``natsort`` give results that match most file browsers. If this is not installed, +it will fall back on Python's built-in ``locale`` module and will give good +results for most input, but will give poor restuls for special characters. + Sorting by Real Numbers (i.e. Signed Floats) ++++++++++++++++++++++++++++++++++++++++++++ |