Random word generator- Python

前端 未结 5 1767
长情又很酷
长情又很酷 2020-12-23 20:58

So i\'m basically working on a project where the computer takes a word from a list of words and jumbles it up for the user. there\'s only one problem: I don\'t want to keep

5条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-23 21:07

    There is a package random_word could implement this request very conveniently:

     $ pip install random-word
    
    from random_word import RandomWords
    r = RandomWords()
    
    # Return a single random word
    r.get_random_word()
    # Return list of Random words
    r.get_random_words()
    # Return Word of the day
    r.word_of_the_day()
    

提交回复
热议问题