D = map(set, dataSet)
print(len(D))
python2.x中,map()函数返回list对象,list对象有len()方法
python3.x中,map()函数返回迭代器对象,没有len()方法
将map()函数返回的对象转为list对象即可
D = list(map(set, dataSet))
print(len(D))
注意迭代器对象每次for循环、转为list对象都会清空迭代器对象本身(迭代器下标改变)
D = map(set, dataSet)
print(len(D))
python2.x中,map()函数返回list对象,list对象有len()方法
python3.x中,map()函数返回迭代器对象,没有len()方法
将map()函数返回的对象转为list对象即可
D = list(map(set, dataSet))
print(len(D))
注意迭代器对象每次for循环、转为list对象都会清空迭代器对象本身(迭代器下标改变)