import regex as re with open('simple.in', encoding='utf8') as file: lines = file.readlines() for line in lines: line = line.strip() print(line)