with open('found_tables.sql', 'r') as file: for i, line in enumerate(file): if i < 7: print(line.strip()) else: break