question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'_' can't be right sorted in Windows

See original GitHub issue

In windows OS, I want to sorted files in a content with a natural way. But I found your code seems to be not well done in windows. The '_' is sorted after number '0-9'. But in windows OS, the '_' is showed before number '0-9'.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:27 (16 by maintainers)

github_iconTop GitHub Comments

3reactions
SethMMortoncommented, Nov 16, 2020

OK - I have finally decided how I want to implement this.

  1. I am going to introduce the functions winsorted and winsort_key into the API
  2. These functions will use the Windows API directly in order to perform their actions, similar to this answer
  3. Because the Windows API is used, this will only be available on Windows.
  4. Because the Windows API handles everything in a black-box fashion, there will be no alg option for customization of the results (though I will still provide key)
2reactions
SethMMortoncommented, Nov 12, 2017

It does seem that Microsoft has a custom sorting order for characters (at least for Excel) as can be seen in the table given here. In this table the _ character appears before numbers, which is not how it appears in the ASCII table. This is why Python’s sorted (and thus natsorted) places the _ character after and not before number characters.

Having said this, it’s not clear to me what the request is here. As filed, the issue simply states that natsort is “not well done in windows” and points out the behavior of natsorted compared to Windows Explorer. Is this

  • a question on how to make natsort return the same results as Windows Explorer?
  • an enhancement request to allow the user to modify the sorting table to match Windows Explorer?
Read more comments on GitHub >

github_iconTop Results From Across the Web

My files will not sort alpha-numerically in Windows 10
1. Run gpedit.msc to open the Local Group Policy Editor · 2. Navigate to: Computer Configuration -> Administrative Templates -> Windows ...
Read more >
How to Sort and Select Files and Folders Windows 10 [Tutorial]
Right -click in an empty area in the folder and select either the Group by or Sort by option. Wait for the sub-menu...
Read more >
Turn off Numerical Sorting in Windows 10 File Explorer
In Windows 10, numerical sorting is enabled by default and file explorer ... Right-click any blank area in the right pane and select...
Read more >
Sort and arrange items in the Finder on Mac - Apple Support
Sort and arrange items in the Finder on Mac. There are four ways to view items in a Finder window: as icons, as...
Read more >
Cannot permanantly sort items in Windows Explorer
After you get it sorted/arranged the way you want, instead of closing the folder with the red "X" upper right, hold the shift...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found