Answers for "how to sort a list of strings in python"

-1

python sort list string

# s = list with strings
s.sort(key=str.lower)
Posted by: Guest on March-26-2021
0

sort list in python by substring

mylist = ['XYZ-78.txt', 'XYZ-8.txt', 'XYZ-18.txt'] 
print(sorted(mylist, key=lambda x: int(x.split("-")[-1].split(".")[0])))
Posted by: Guest on September-29-2020

Code answers related to "how to sort a list of strings in python"

Python Answers by Framework

Browse Popular Code Answers by Language