Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
有没有办法用python检查列表中的字符串是否是普通英语中使用的真实单词?_Python_Python 3.x - Fatal编程技术网

有没有办法用python检查列表中的字符串是否是普通英语中使用的真实单词?

有没有办法用python检查列表中的字符串是否是普通英语中使用的真实单词?,python,python-3.x,Python,Python 3.x,我试图从一个关键字列表中提取出英语中常见的单词 这是我的密码: words = ['apple','a%32','j & quod','rectangle','house','fsdfdsoij','fdfd'] for word in words: if word ???: # How can I check if the words is a real word? Any module that I can use for that or a free API?

我试图从一个关键字列表中提取出英语中常见的单词

这是我的密码:

words = ['apple','a%32','j & quod','rectangle','house','fsdfdsoij','fdfd']
for word in words:
    if word ???: # How can I check if the words is a real word? Any module that I can use for that or a free API?
        print:
    else:
        pass
我只想得到以下结果:

apple
rectangle
house

第一步,安装nltk

然后:

试试:-他们的英语很好。
import nltk
nltk.download('words')

from nltk.corpus import words

samplewords=['apple','a%32','j & quod','rectangle','house','fsdfdsoij','fdfd']

[i for i in samplewords if i in words.words()]

['apple', 'rectangle', 'house']