标签: python
我有一个简单的数组:
a = [1,2,3,6,7,10,11,12,15,16]
如何填充缺少元素的数组?
答案 0 :(得分:6)
range(min(a), max(a) + 1) # [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]