Answers for "how to choose a random word from a text file in python"

1

choice random word in python from a text file

import random
print(random.choice(open('file.txt').read().split()).strip())
Posted by: Guest on October-19-2020

Code answers related to "how to choose a random word from a text file in python"

Python Answers by Framework

Browse Popular Code Answers by Language