mercredi 7 juillet 2021

I have a list of comments, how to choose one by one, without repeating the same comment [duplicate]

def random_comment():
    with open('comments.txt', 'r') as f:
        comments = [line.strip() for line in f]
    comment = random.choice(comments)
    return comment



Aucun commentaire:

Enregistrer un commentaire