I have a list that its elements are composed of a letters and numbers as shown below :
['H1', 'H100', 'H10', 'H3', 'H2', 'H6', 'H11', 'H50', 'H5', 'H99', 'H8']
I wanted to sort it, so I used the function sort, but I got as output :
>>> a = ['H1', 'H100', 'H10', 'H3', 'H2', 'H6', 'H11', 'H50', 'H5', 'H99', 'H8']
>>> print sorted(a)
['H1', 'H10', 'H100', 'H11', 'H2', 'H3', 'H5', 'H50', 'H6', 'H8', 'H99']
However, I want the output to be :
['H1', 'H2', 'H3', 'H5', 'H6', 'H8', 'H10', 'H11', 'H50', 'H99', 'H100']
Does anyone has an idea how to do this please? Thank you