Removal of the same element of the array

 python: using the set

 

Python 3.5.4 (v3.5.4:3f56838, Aug  8 2017, 02:17:05) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> a=[1,2,3,4,5,3,2,1]
>>> a
[1, 2, 3, 4, 5, 3, 2, 1]
>>> set(a)
{1, 2, 3, 4, 5}
>>>



matlab: Use UNIQUE (A) returns a list consisting of the elements will not be repeated in A, corresponding to a set of transfer list.

Published 234 original articles · won praise 61 · views 120 000 +

Guess you like

Origin blog.csdn.net/weixin_42528089/article/details/103986371