Is there a built-in method to do it? If not how can I do this without costing too much overhead?
import random with open("file.txt", "r") as f: lines = f.readlines() print (random.choice(lines))