sort the elements according to their lengths : Sort : List PYTHON TUTORIALS


PYTHON TUTORIALS » List » Sort »

 

sort the elements according to their lengths


x = ['a''ab', 'ac', 'add', 'ae']
x.sort(key=len)
print x



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo List
» Sort