Is there a built-in method to do it? If not how can I do this without costing too much overhead?
It depends what do you mean by "too much" overhead. If storing whole file in memory is possible, then something like
import random random_lines = random.choice(open("file").readlines())
would do the trick.