SHARE
TWEET

UniqueItemsList

IvaSerge Aug 22nd, 2019 191 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. outlist = list()
  2. #inList = IN[0]
  3.  
  4. #тестовый список
  5. inList = ["test1","test1","test1","test2","test2","test3"]
  6.  
  7.  
  8. #создаем список уникальных значений
  9. uniqueItems = set(inList)
  10.  
  11. for item in uniqueItems:
  12.     #генератором списка отфильтровываем нужное значение
  13.     tempList = [i for i in inList if i == item]
  14.     outlist.append(tempList)
  15.  
  16. OUT = outlist
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top