If I assign an integer to the dir_fd
argument of os.fwalk()
, a fourth value ist added to each of the tuples generated by list(os.fwalk())
.
I understand that they have something to do with the hierarchy in which the files and directories are organised, but I don't quite get their exact meaning.
Also, the values change, depending on the integer assigned to dir_fd, and there is always one number missing (in this case 82
, see below).
Any ideas?
Code:
import os
os.chdir("/home/test")
inp = str(os.getcwd() + "/input")
l = list(os.fwalk(inp, dir_fd=3))
Output:
[('/home/test/input', ['a', 'b', 'c'], ['d.txt'], 80),
('/home/test/input/a', ['aa'], ['ac.txt', 'ab.txt'], 81),
('/home/test/input/a/aa', [], [], 83),
('/home/test/input/b', [], ['bb.txt', 'bc.txt', 'ba.txt'], 81),
('/home/test/input/c', ['ca'], [], 81),
('/home/test/input/c/ca', ['caa'], ['cab.txt'], 83),
('/home/test/input/c/ca/caa', [], ['caaa.txt'], 84)]