I am struggling with the identification of specific items in a Python list. The list contains of 14 foldernames within my directory (dir). These can be separated by filtering for a combination of three letters (e.g. 'UPB') within the folder's name. I need the name of the folder to start a process with that string.
Therefore I tried this code:
[a for a in dir if a != "*UPB*"]
This should give me all the list elements from 'dir' which contain the string "UPB", right? However, it doesn't work and I'd be glad to get some helpful information!