try: fp = open('adat.txt', 'r', encoding='utf-8') lista = fp.read().splitlines() finally: fp.close() print(lista)