Using a list comprehension
myList=[-2,-1,0,1,2,3,1,2,3]
result=[each for each in myList if each>0]
Results to:
[1,2,3,1,2,3]
How to avoid the duplicated values in returned list?
Using a list comprehension
myList=[-2,-1,0,1,2,3,1,2,3]
result=[each for each in myList if each>0]
Results to:
[1,2,3,1,2,3]
How to avoid the duplicated values in returned list?