Closed mc-m closed 6 years ago
Hi @mc-m
It seems that in your call to walktree
you have two extra `
It should just be r'\.txt$'
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,
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
.
I can't seem to obtain any resut from the walktree function.
I'm doing this: filename = walktree(top= '../../data/Trials', spec=
r'\.XML$'
)and the function acts like if I had no file in that directory whatsoever (see images for better understanding).
Thank you