How to sort the letters in a string alphabetically in Python

You can do:

>>> a="ZENOVW"
>>> ''.join(sorted(a))
'ENOVWZ'

Leave a Comment