I have this class called Suffix():
class Suffix:
def __init__(self, index, suffix):
self.index = index #int
self.suffix = suffix #string
def __repr__(self):
return f'({self.index},{self.suffix})'
I have a list with a bunch of instances from this class called sa = [suffix list]
Now I want to sort sa alphabetically according to the first 36 characters of the suffix string of the suffix.
I found Sort strings by the first N characters that showed me
sorted(array, key=lambda x:x[:24])
But is there a way to implement this without putting all my suffixes into a seperate array, that would defeat my purpose.