import os folder = os.getcwd() answer = input(f"the path is {folder}. Continue?") if answer.lower() != "yes": exit() with open(os.path.join(folder, "en_quotes_64.txt"), "r", encoding="utf-8") as f: contents = f.read() with open(os.path.join(folder, "en_quotes_64.txt"), "w", encoding="utf-8") as f: f.write("\n".join([i for i in contents.split("\n") if len(i) <= 64]))