Python 可以从列表中删除包含任何未大写单词的元素吗?

Can Python remove elements from a list that have any uncapitalized word?

感谢观看。我仍在处理我的命名实体识别项目,我快完成了。我的项目是从一个长字符串中提取所有的人名,我已经到了我有一个名字列表的地步,我将其命名为 ent3。

此列表中有一些先前处理的不正确工件。具体来说,我在列表中有元素,如 'Josie husband' 或 'Laura fingernail'。我想完全消除那些元素。

有没有办法让 Python 遍历列表并删除任何包含未大写单词的元素?

我们到了

names = [
    'Jose Maria',
    'Alex Qqq',
    'Alex daddy',
    'Maria Fernandez',
    'Joe Dohn',
    'Dani mother'
]

clean = [x for x in names if not any((word.lower() == word for word in x.split()))]

print(clean)

输出

['Jose Maria', 'Alex Qqq', 'Maria Fernandez', 'Joe Dohn']