Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to get random word from text file in python

import random
def importword(): # finding a random word in the dictionary
    file = open("wdd.txt", "r")
    for x in range(0,random.randint(0,466909)):
        word = file.readline(x)
    return word
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #random #word #text #file #python
ADD COMMENT
Topic
Name
3+9 =