python 基础之排序

#先sorted以从小到大的顺序排列,然后reversed倒转变为从大到小输出,后用+ 链接起来
print '+'.join(reversed(sorted('891532')))

#同上,以字典形式输出
print zip('+'.join(reversed(sorted('891532'))))

posted @ 2017-06-25 15:34  人间好时节  阅读(211)  评论(0编辑  收藏  举报