jeudi 17 août 2017

How to print two different random lines from text file

I need to print two different random lines from text file. Below is the code to print one line, how would I make it print two different lines rather than the possibility of two the same.

import random
with open('Long films') as f:
    lines = f.readlines()
    print(random.choice(lines))




Aucun commentaire:

Enregistrer un commentaire