So in short, i have a directory that looks like
All the given text files look like
and I want to iterate through each file and input the text This is file #i at a certain line where i is the EXACT number of the file in its file name. I've watched countless videos on the os module, but still cant figure it out.
So just for reference,
is the goal im trying to reach for each file within the directory.



I would do it like this:
You can have
indirpathandoutdirpathas the same if your goal is to overwrite the original files.