import random, string with open("deneme.txt", "+w", encoding="utf-8") as f: kod = "".join(random.choice(string.ascii_letters + string.digits) for i in range(3)) f.write(f"{kod}\n") f.close()