我試圖找到以輔音開頭和結尾的單詞。以下是我所嘗試的,而這不是我正在尋找的。我很困難,需要你的幫助/建議。查找以輔音開頭和結尾的單詞
import re
a = "Still, the conflicting reports only further served to worsen tensions in the Ukraine crisis, which has grown drastically \
in the past few weeks to a new confrontation between Russia and the West reminiscent of low points in the Cold War."
b = re.findall(" ([b, c, d, f, g, h, j, k, l, m, n, p, q, r, s, t, v, w, x, y, z, ',', '.'].+?[b, c, d, f, g, h, j, k, l, m, n, p, q, r, s, t, v, w, x, y, z, ',', '.']) ", a.lower())
print(b)
輸出是:
['the conflicting', 'further', 'to worsen', 'the ukraine crisis,', 'has', 'drastically', 'the past', 'weeks', 'new', 'between', 'the west', 'low', 'the cold']
但輸出是不正確的。我必須使用正則表達式。沒有它,我想,這太艱難了。
非常感謝!
你要包括逗號和句號? – 2rs2ts