zip函数的使用

s = [[1, 10], [1.2, 11], [2, 5], [5, 15]]
data = zip(*s)
x_list = data[0]
y_list = data[1]
x_min = min(x_list)
x_max = max(x_list)
y_min = min(y_list)
y_max = max(y_list)
box = [x_min, x_max, y_min, y_max]
print(box)  # [1, 5, 5, 15]

 

posted @ 2018-09-11 18:23  PLAY_JOY  阅读(194)  评论(0编辑  收藏  举报