Im trying to combine all .txt files in a directory and output them after the last one.
I have following Filesystem structure:
objects
object1
attribute1.txt
attribute2.txt
attribute3.txt
object2
attribute1.txt
attribute2.txt
attribute3.txt
and so on...
I've looked up this code
for subdir, dirs, files in os.walk(rootdir):
for file in files:
# collect the information
I am looking for a for loop like
for subdir, dirs, files in os.walk(rootdir): # <- what do I need to change here?
for object in objects: # <- how to implement this line correctly?
for file in files:
# collect the information
print(information)
But I have to idea how to do that, since I am very new to python.
EDIT:
Python concatenate text files does not answer my question, since there is not an actual loop but only an Array with file names.