Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
List sort - alphanumeric?
#1
Hello,
i ve just started learning python and i have bumped into a problem when reading folder names from a directory. they are not sorted the same way i am viewing them in my directory.

f1,f2,f3.....,f10,f11,...f20,f21,f23 becomes f1,f10,f11,f12...f2,f21,f22...etc

i would like to sort them by name like in windows
Reply
#2
see: https://stackoverflow.com/a/11150413
Reply
#3
yes worked! thank a lot
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  list.sort() returning None SmallCoder14 8 403 Mar-19-2024, 09:49 PM
Last Post: SmallCoder14
  Sort a list of dictionaries by the only dictionary key Calab 1 452 Oct-27-2023, 03:03 PM
Last Post: buran
Photo a.sort() == b.sort() all the time 3lnyn0 1 1,277 Apr-19-2022, 06:50 PM
Last Post: Gribouillis
  list sort() function bring backs None CompleteNewb 6 3,997 Mar-26-2022, 03:34 AM
Last Post: Larz60+
  [solved] Sort list paul18fr 5 2,799 Aug-18-2021, 06:34 AM
Last Post: naughtyCat
  Sort List of Lists by Column Nju 1 10,034 Apr-13-2021, 11:59 PM
Last Post: bowlofred
  sorting alphanumeric values in a human way idiotonboarding 3 2,552 Jan-22-2021, 05:57 PM
Last Post: idiotonboarding
  How to sort os.walk list? Denial 6 11,287 Oct-10-2020, 05:28 AM
Last Post: Denial
  Converting to a list and sort tantony 6 3,130 Oct-07-2019, 03:30 PM
Last Post: perfringo
  syntax error on list.sort() jjordan33 3 3,146 Jul-10-2019, 04:57 PM
Last Post: jefsummers

Forum Jump:

User Panel Messages

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