ChatGPT ingilizce sorunca anladı sorunu çözdüm
import random
# specify the file path
file_path = "xxx.txt"
# read the file and save the lines in a list
with open(file_path) as f:
lines = f.readlines()
# select a random line
random_line = random.choice(lines)
# remove the selected line from the list
lines.remove(random_line)
# write the remaining lines back to the file
with open(file_path, "w") as f:
f.writelines(lines)
# print the selected line
print(random_line)