That's because Path.glob returns a generator, i.e an object that returns values when next is called which has absolutely no idea what appending is.
You have two options here, if you require a list wrap the paths in a list call:
paths = list(Path('folder_with_pdfs').glob('**/*.pdf')) paths.append(list(Path('folder_with_xlss').glob('**/*.xls')))
(Even though extend is probably what you're after here.)
this of course defeats the purpose of the generator.
So, I'd suggest using something like chain and creating a generator that will combine them and yield from them one at a time:
from itertools import chain p1 = Path('folder_with_pdfs').glob('**/*.pdf') p2 = Path('folder_with_xlss').glob('**/*.xls') paths = chain(p1, p2)
Then iterating over paths as required while keeping the memory footprint down.