Answers for "how do i make sure a line doesn't repeat from a file in python"

0

how do i make sure a line doesn't repeat from a file in python

from random import sample

file_name = "text_database.txt"
lines = open(file_name, "r").read().splitlines()

for line in sample(lines, k=len(lines)):
    print(line)
Posted by: Guest on March-14-2021

Code answers related to "how do i make sure a line doesn't repeat from a file in python"

Python Answers by Framework

Browse Popular Code Answers by Language