Walktree not working
mc-m opened this issue · 3 comments
mc-m commented
capcarr commented
Hi @mc-m
It seems that in your call to walktree
you have two extra `
It should just be r'\.txt$'
mc-m commented
Yes, you were right, thank you!
However, I'm getting another error. Not sure if it's about this fuction or not.
Also, @capcarr, how does the function return the file names when there's more than one? Is it a list?
Thank you,
capcarr commented
Hi @mc-m
The function returns a generator function, which are useful in iterative loops.
You can obtain a list with all the elements by doing:
files = list(walktree(...))
Regarding your error, it seems that you are feeding the variable filename
to another function, which expects a string. You probably wanted to pass f
.