可以通過使用set()來去掉重復數據。以下是一個示例代碼:
data = [1, 2, 3, 4, 4, 5, 6, 6, 7] unique_data = list(set(data)) print(unique_data)
在這個示例中,將列表data轉換為集合set,然后再轉換為列表,最終得到了去掉重復數據的unique_data。