Here’s how to read a file line by line with multiple columns.
with open('file.txt') as file:
for line in file:
line = line.strip()
columns = line.split()
col1 = columns[0]
col2 = columns[1]
some_function(col1, col2)
home > blog > /2023/06/26/python-read-file-multiple-columns.html