Python Example | Read File Line by Line

This python example code will show us how to read content line by line from a file.

# read file line by line
with open("email.txt",'r') as email:
    # read the file with a for loop
    for line in email:
        # strip the newline character from the line
        print(line.strip())