import re
vowelRegex = re.compile(r'[aeiouAEIOU]')
mo = vowelRegex.findall('darjhs jdhIQRd dhjuwqkj')
print(mo)
fanRegex = re.compile(r'[^aeiouAEIOU]')
mo1 = fanRegex.findall('darjhs jdhIQRd dhjuwqkj')
print(mo1)
结果是:
['a', 'I', 'u']
['d', 'r', 'j', 'h', 's', ' ', 'j', 'd', 'h', 'Q', 'R', 'd', ' ', 'd', 'h', 'j', 'w', 'q', 'k', 'j']