We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replacing python's default sorting to more human recognizable way.
import copy import re def sort_human(input_list): l = copy.copy(input_list) convert = lambda text: float(text) if text.isdigit() else text alphanum = lambda key: [ convert(c) for c in re.split('([-+]?[0-9]*\.?[0-9]*)', key) ] l.sort( key=alphanum ) return l
Example:
>>> a=['a_1', 'a_11', 'a_2'] >>> sorted(a) ['a_1', 'a_11', 'a_2'] >>> sort_human(a) ['a_1', 'a_2', 'a_11']
Further detail: PCMDI/click#10
The text was updated successfully, but these errors were encountered:
Marking issue as stale, since there has been no activity in 30 days.
Unless the issue is updated or the 'stale' tag is removed, this issue will be closed in 7 days.
Sorry, something went wrong.
@lee1043 @pochedls this could be a good candidate for https://github.com/PCMDI/climlib
No branches or pull requests
Replacing python's default sorting to more human recognizable way.
Example:
Further detail: PCMDI/click#10
The text was updated successfully, but these errors were encountered: