[英]How do I remove english stop words from a dataframe column using a custom dictionary of stop words
[英]How do I generate random words from the english dictionary? [on hold]
我不知道如何生成不必輸入到 python 代碼中的隨機詞。 我該怎么做? 我對 python 有點陌生。
您需要找到一個來源,這可能是一個簡單的文本文件、一個網站、一個 excel 文件......
然后你將簡單地加載你的源代碼並使用隨機模塊來生成你的隨機詞。
from random import choice
with open("my_source.txt", "r") as source:
words = source.readlines()
random_word = choice(words)
print(random_word)
您的源文件應如下所示
marine
python
windows
enough
sunny
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.