3/17/2020

get unique value from list (python source code)

..
import numpy as np

def unique(list1):
x = np.array(list1)
x = np.unique(x)
return list(x)

list1 = [10, 20, 10, 30, 40, 40]
list1 = unique(list1)
print(list1)
..
output
[10, 20, 30, 40]
..

No comments:

Post a Comment