fileinput seems to be for multiple input streams. This is what I would do:
with open("test.txt") as file:
for line in file:
line = line.rstrip()
if line:
print(line)
fileinput seems to be for multiple input streams. This is what I would do:
with open("test.txt") as file:
for line in file:
line = line.rstrip()
if line:
print(line)