Driving Innovation, Scaling Solutions
Use readlines() to use the break lines of the file and turn it into an item in a list.
with open('file.txt') as file: content = file.readlines() random_line = random.choice(content)
Have any questions or comments? Write them below!
Your email address will not be published. Required fields are marked *
Comment *
Save my name, email, and website in this browser for the next time I comment.