def str_bubble(s1): if s1: if isinstance(s1[0], int): n = len(s1) s1 = list(map(lambda x: str(x), s1)) else: pass for i in range(n): for j in range(i + 1, n): if int(s1[i] + s1[j]) > int(s1[j] + s1[i]): pass else: s1[i], s1[j] = s1[j], s1[i] return s1
原创文章,作者:bd101bd101,如若转载,请注明出处:https://blog.ytso.com/270985.html