#!/usr/bin/env python3.9

from pathlib import Path

path = Path("~/.pythonhistory3").expanduser()

old = path.read_text()
seen = set()

with path.open("w") as f:
    for line in old.splitlines(True):
        if line.strip() in seen:
            continue
        seen.add(line.strip())
        f.write(line)

