1.list转setSet set = new HashSet(new ArrayList()); 2.set转listList list = new ArrayList(new HashSet()); 3.数组转为listList stooges = Arrays.asList("Larry", "Moe", "Curly");或者String[] arr = {"1", "2"};List list =…
一.方法1 代码如下 复制代码 ids = [1,2,3,3,4,2,3,4,5,6,1] news_ids = [] for id in ids: if id not in news_ids: news_ids.append(id) print news_ids 思路看起来比较清晰简单 ,也可以保持之前的排列顺序. 二.方法2 通过set方法进行处理 代码如下 复制代码 ids = [1,4,3,3,4,2,3,4,5,6,1] ids = list(set(ids…