將這些變量存入set去重,而後再轉化爲list,和原來list比較,若是a不等於b,則說明a中有重複數據了,若是len(b)=1,則說明a中元素均相等。python
a = [0,0,1,2,3,4,5,6,6,7] b = list(set(a)) a == b