python sort list string
# s = list with strings
s.sort(key=str.lower)
python sort list string
# s = list with strings
s.sort(key=str.lower)
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])))
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us