Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to do a numeric sort
#1
i think all that is needed is a sort key function for this. i want to have a list of files sorted in a numeric way so that:
Output:
python-3.4.0-foo.gz python-3.4.1-foo.gz python-3.4.10-foo.gz python-3.4.2-foo.gz python-3.4.3-foo.gz python-3.4.4-foo.gz python-3.4.5-foo.gz python-3.4.6-foo.gz python-3.4.7-foo.gz python-3.4.8-foo.gz python-3.4.9-foo.gz python-3.5.0-foo.gz python-3.5.1-foo.gz python-3.5.2-foo.gz python-3.5.3-foo.gz python-3.5.4-foo.gz python-3.5.5-foo.gz python-3.5.6-foo.gz python-3.5.7-foo.gz
gets sorted like:
Output:
python-3.4.0-foo.gz python-3.4.1-foo.gz python-3.4.2-foo.gz python-3.4.3-foo.gz python-3.4.4-foo.gz python-3.4.5-foo.gz python-3.4.6-foo.gz python-3.4.7-foo.gz python-3.4.8-foo.gz python-3.4.9-foo.gz python-3.4.10-foo.gz python-3.5.0-foo.gz python-3.5.1-foo.gz python-3.5.2-foo.gz python-3.5.3-foo.gz python-3.5.4-foo.gz python-3.5.5-foo.gz python-3.5.6-foo.gz python-3.5.7-foo.gz
anyone know of code that can do this?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
how to do a numeric sort - by Skaperen - Jul-10-2019, 04:13 AM
RE: how to do a numeric sort - by perfringo - Jul-10-2019, 04:48 AM
RE: how to do a numeric sort - by scidam - Jul-10-2019, 04:54 AM
RE: how to do a numeric sort - by Skaperen - Jul-10-2019, 05:02 AM
RE: how to do a numeric sort - by perfringo - Jul-10-2019, 05:13 AM
RE: how to do a numeric sort - by Skaperen - Jul-10-2019, 05:49 AM
RE: how to do a numeric sort - by perfringo - Jul-10-2019, 07:18 AM
RE: how to do a numeric sort - by Gribouillis - Jul-10-2019, 07:27 AM
RE: how to do a numeric sort - by Skaperen - Jul-12-2019, 02:05 AM
RE: how to do a numeric sort - by Gribouillis - Jul-12-2019, 04:38 AM
RE: how to do a numeric sort - by Skaperen - Jul-12-2019, 09:50 AM
RE: how to do a numeric sort - by DeaD_EyE - Jul-12-2019, 06:13 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Numeric Enigma Machine idev 9 3,288 Mar-29-2024, 06:15 PM
Last Post: idev
Photo a.sort() == b.sort() all the time 3lnyn0 1 2,124 Apr-19-2022, 06:50 PM
Last Post: Gribouillis
Question Numeric Anagrams - Count Occurances monty024 2 2,371 Nov-13-2021, 05:05 PM
Last Post: monty024
  How to get datetime from numeric format field klllmmm 3 2,883 Nov-06-2021, 03:26 PM
Last Post: snippsat
  seeking simple|clean|pythonic way to capture {1,} numeric clusters NetPCDoc 6 4,671 Jun-10-2021, 05:14 PM
Last Post: NetPCDoc
  Extract continuous numeric characters from a string in Python Robotguy 2 3,901 Jan-16-2021, 12:44 AM
Last Post: snippsat
  How to calculate column mean and row skip non numeric and na Mekala 5 7,606 May-06-2020, 10:52 AM
Last Post: anbu23
  Alpha numeric element list search rhubarbpieguy 1 2,506 Apr-01-2020, 12:41 PM
Last Post: pyzyx3qwerty
  convert a character to numeric and back Skaperen 2 2,998 Jan-28-2020, 09:32 PM
Last Post: Skaperen
  are numeric types passed by value or reference? rudihammad 4 3,701 Nov-19-2019, 06:25 AM
Last Post: rudihammad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020