summaryrefslogtreecommitdiff
path: root/README.rst
diff options
context:
space:
mode:
authorSeth Morton <seth.m.morton@gmail.com>2020-11-17 23:15:18 -0800
committerSeth Morton <seth.m.morton@gmail.com>2020-11-17 23:29:18 -0800
commit3f5439cbc2d5caab514a9d6053d7359e9f3c05eb (patch)
tree5c9a25689cfef4d16b0b1356b2fcc3cd8db95a76 /README.rst
parentcde07bbcb24a95b5ef5b5796ab870020b9b8a163 (diff)
downloadnatsort-3f5439cbc2d5caab514a9d6053d7359e9f3c05eb.tar.gz
Documentation updates
Diffstat (limited to 'README.rst')
-rw-r--r--README.rst25
1 files changed, 25 insertions, 0 deletions
diff --git a/README.rst b/README.rst
index bbc065c..65cca26 100644
--- a/README.rst
+++ b/README.rst
@@ -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)
++++++++++++++++++++++++++++++++++++++++++++