home ~ projects ~ socials

Read A File Line By Line In Python

You can just use the file handle with a for loop.

for file in source_files:
    with open(file) as _file:
        for line if _file:
            print(line)
-- end of line --