赞
踩
a
>>> ['7:00', '8:00', '9:20', '10:00', '11:00', '12:00', '12:50', '14:00', '14:50', '16:00', '17:00', '17:50', '21:00', '22:30', '9:00', '10:30', '11:00', '12:30', '14:00', '15:00', '16:00', '17:10', '18:00', '19:00', '21:00', '22:30']
b = sorted(a, key=lambda x: int(x[:-3]+x[-2:]))
b
>>> ['7:00', '8:00', '9:00', '9:20', '10:00', '10:30', '11:00', '11:00', '12:00', '12:30', '12:50', '14:00', '14:00', '14:50', '15:00', '16:00', '16:00', '17:00', '17:10', '17:50', '18:00', '19:00', '21:00', '21:00', '22:30', '22:30']
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。