How To Deal With Case Sensitive Sorting For Output Files?
I have written a program that randomly generates a series of 5 letters (ASCII, both upper and lower case) in column 1 of a csv and 4 numbers (0-9) in column 2 of a csv and saves th
Solution 1:
I ran into this recently as well, and it - assuming your data is in a list - can be solved very simply by specifying the optional key
argument:
li = ['ANcPI', 'DLBvA', 'FpSCo', 'beMhy', 'dWDjl']
li.sort(key=lambda m : m.lower())
Then,
>>>print(li)
['ANcPI', 'beMhy', 'DLBvA', 'dWDjl', 'FpSCo']
Post a Comment for "How To Deal With Case Sensitive Sorting For Output Files?"