May-05-2021, 04:55 AM
Greetings!
I'm trying to filter files in a directory using the function 'any()',
The problem is I can't find any good examples on the net about it.
For example, I want to print names of files that do not have the word "latest".
Here is the code I got so far :
Thank you!
I'm trying to filter files in a directory using the function 'any()',
The problem is I can't find any good examples on the net about it.
For example, I want to print names of files that do not have the word "latest".
Here is the code I got so far :
import os from pathlib import Path dtoscan = 'some\\Dir\\To\\Scan\\' tofind = "latest" for fd in os.listdir(dtoscan) : dp = os.path.join(dtoscan,fd) if os.path.isfile(dp) : any(tofind,dp)I could do this without any() function but I really would like to use it.
Thank you!