I want to find all python files in a folder which are not located in a subfolder (e.g. '.ipynb_checkpoints').
My current solution is
from pathlib import Path
rootdir = Path('/home/my_path')
# For absolute paths instead of relative the current dir
file_list = [
f for f in rootdir.resolve().glob('**/*.py')
if not '.ipynb_checkpoints' in str(f)
]
which gives me the correct list.
Neverteheless I was hoping that pathlib has some function like f.includes() or something similar.
Is there a soltion to generate the same list only using the functions of the pathlib package?