1. tuple和list的转换:
使用type()判断类型,然后使用tuple()和list()函数
>>> a = [1, 2, 3]
>>> type(a)
<class 'list'>
>>> a = tuple(a)
>>> a
(1, 2, 3)
>>> a = dict(a)
2. 实现删除一个list里重复的元素
集合 class set (object):Build an unordered collection of unique elements. 无序不重复元素的集合。
有union(联合), intersection(交), difference(差)和sysmmetric difference(对称差集)等数学运算.
也有一般的copy(),clear(),pop(),remove()等方法