去重操作源码:
#去重并排序 s='sjlfgafdhjshdjfhsajhfjahfjhddd' s=set(s) print(s,type(s)) s=list(s) print(s,type(s)) s.sort(reverse=True)#默认是False是从小到大排列 print(s) res=''.join(s) print(res)
去重操作源码:
#去重并排序 s='sjlfgafdhjshdjfhsajhfjahfjhddd' s=set(s) print(s,type(s)) s=list(s) print(s,type(s)) s.sort(reverse=True)#默认是False是从小到大排列 print(s) res=''.join(s) print(res)
转载于:https://www.cnblogs.com/liangliangzz/p/10302216.html