Hi
I've been trapped by names I've been getting in a list; I spent some time in looking in internet to find a way; in the current example, I want that list index 1 correspond to 'Name_2' and not 'Name_10' (and so on, in ascending order)
Is there a basic instruction or should I need to split numbers from strings in order to sort?
Thanks for advices
Paul
I've been trapped by names I've been getting in a list; I spent some time in looking in internet to find a way; in the current example, I want that list index 1 correspond to 'Name_2' and not 'Name_10' (and so on, in ascending order)
Is there a basic instruction or should I need to split numbers from strings in order to sort?
Thanks for advices
Paul
MyList = ['Name_1', 'Name_10', 'Name_2', 'Name_20', 'Name_3', 'Name_32'] print(f"Initial = {MyList}") print() print(f"Test 1 = {sorted(MyList)}")