【发布时间】:2025-11-30 09:50:01
【问题描述】:
字符串在搜索中无法通过 and or 匹配。为什么?
string = 'This is some text with an email add: myusername@domain.com'
a = re.findall('[\w]+@[\w]+\.[\w]{3}',string)
b = string.split(' ')
print (a)
print (b)
if a==b:
# also tried: if a in b:
print(a, ' yes it is found')
else:
print('not !?!?!')
['myusername@domain.com']
['This', 'is', 'some', 'text', 'with', 'an', 'email', 'add:', 'myusername@domain.com']
not !?!?!
【问题讨论】: