Jan-29-2023, 01:49 PM
You could use fileinput to read many files.
import fileinput files = fileinput.input(("file1.txt", "file2.txt"), encoding="utf8") for line in files: lineno = files.lineno() filename = files.filename() filelineno = files.filelineno() print(f"[{filename:<15}] [{filelineno:>4d}]: {line}", end="")So, if you need the current file, line number and total line number, you could use this.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!