name_lis = [] name_set = set(name_lis) new = ['Jenny', 'Ellena', 'Alice', 'Candy', 'David', 'Hally', 'Bob', 'Isen', 'Karl'] print(name_set.update(new))
name_lis = [] name_set = set(name_lis) new = ['Jenny', 'Ellena', 'Alice', 'Candy', 'David', 'Hally', 'Bob', 'Isen', 'Karl'] final = name_set.update(new) print(final)
谢谢!
因为update()函数不返回结果,直接操作name_set,直接打印name_set可以得到你想要的结果。