擅长:python、mysql、java
<p>像这样:</p>
<pre><code>a=[0, 10, 20, 30, 40, 50, 60]
b = a[1:3]
c =[x for x in a if x not in b]
print(a)
print(b)
print(c)
</code></pre>
<p>输出:</p>
^{pr2}$
<p>如果顺序无关紧要,可以将列表填充到集合中并使用<a href="https://docs.python.org/2/library/sets.html#set-objects" rel="nofollow noreferrer">these set operations</a>:
<code>yourSet.union(otherSet)</code>,<code>yourSet.intersect(otherSet)</code>`你的。区别(其他设置)等</p>