Re: python, I'm being dumb... again!
@5, that's odd -- it always seemed like os.walk was non-recursive to me. Maybe it was the examples I was looking at.
URL: https://forum.audiogames.net/post/433454/#p433454
--
Audiogames-reflector mailing list
Audiogames-reflector@
Re: python, I'm being dumb... again!
@5, that's odd since all the "recursive directory iterators" in Python always recursively called themselves with os.walk to "simulate recursion.". I wish that function was more obvious in what it did; at least C++ has recur
Re: python, I'm being dumb... again!
@Ethin os.walk is indeed recursive. @1, basically when you loop through output from os.walk, you are getting a list with 3 items in it. This is usually represented by something like for root, dirs, files in os.walk(directory). However you can
Re: python, I'm being dumb... again!
@Ethin os.walk is indeed recursive. @1, basically when you loop through output from os.walk, you are getting a list with 3 items in it. This is usually represented by something like for root, dirs, files in os.walk(directory). However you can
Re: python, I'm being dumb... again!
No, it won't. Os.walk doesn't do that either.
URL: https://forum.audiogames.net/post/433251/#p433251
--
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/m
Re: python, I'm being dumb... again!
Thanks for the quick reply. I looked at os.scandir and it only seems to loop through the folders and work on the root of the folder. So if I have my documents folder and I use os.scandir on it, if I have any folders within documents it won'
Re: python, I'm being dumb... again!
Root is the directory your walking. drs is the directories within that folder. Files are the actual files in that folder. It is possible using the drs return value to create a recursive directory scanner. As a side note, I'd recommend using
python, I'm being dumb... again!
So, for the life of me, I can't figure out what does the os.walk(directory) do. I know it scans the files in some way, but I just don't understand... how?I saw a loop that had 3 arguments when using os.walk. Something like this.for root