Define your own sort function:
Characters are compared by their ascii values, so 'A' (65) is always less than 'A' (97), but you can change this by returning a lower value for 'A' compared to 'A' .
In [39]: lis=[(u'First', 23),(u'laSt',1), (u'Second', 64),(u'last', 19),(u'FirSt',5)] In [40]: def mysort(x): elem=x[0] return [ord(x)-97 if x.islower() else ord(x) for x in elem] ....: In [41]: sorted(lis,key=mysort) Out[41]: [(u'last', 19), (u'laSt', 1), (u'First', 23), (u'FirSt', 5), (u'Second', 64)]
source share