Sorting elements in string with Python
Posted
by prosseek
on Stack Overflow
See other posts from Stack Overflow
or by prosseek
Published on 2010-04-08T02:11:35Z
Indexed on
2010/04/08
2:13 UTC
Read the original article
Hit count: 288
I need to sort string, and I came up with the following function.
def mysort(comb_): str = [] size = len(comb_) for c in comb_: str.append(c) str.sort() return ''.join(str)
Is there any way to make it compact?
© Stack Overflow or respective owner