dimanche 28 octobre 2018

How to get random row from "list.txt" by Python [duplicate]

This question already has an answer here:

list.txt is like this:

aa
bbb
cccc

It's not so big file.

so... what should I do next?

with open('list.txt', 'r') as f:

I tried random.shuffle(f), but unfortunately it didn't work out.




Aucun commentaire:

Enregistrer un commentaire