如何删除列表列表中的重复项?

How to delete duplicates in a list of lists?

我做错了什么,我应该怎样修正第三行的错误?

我正在尝试
遍历 expsList
中的每个内部列表 使用 DeleteDuplicates 并使用 Table 形式删除任何重复项 Table[expr,{i,{i1,i2.....}}] 使用连续值 i1,i2,......

我正在尝试删除每个列表列表中的重复项,然后尝试将输出保存到名为 theDeleted 的变量中。如果我键入 theDeleted = DeletedDuplicates[expList[[1]]],我的代码似乎可以工作,但是当我使用 Table 命令时,我的代码似乎无法工作。那么错误的原因是什么以及我将如何修复它(起诉上面列出的细节)。

 n = 3;
  expList = Table[RandomInteger[{1, 365}, 20], {n}];
  theDeleted = DeleteDuplicates[expList[[Table[x, {x, {1, 2, 3}}]]]];

尝试

theDeleted = Table[DeleteDuplicates[ expList[[x]] ], {x, {1, 2, 3 }} ];

您的代码创建了一些查看 Part Documentation 类型的东西

expr[[{i1,i2,…}]] gives a list of the parts i1, i2, … of expr.

又是原来的列表。

最终你会想要

Map[ DeleteDuplicates, expList ]